2016-06-01 115 views
0

我是Objective-C和Xcode的新手。Xcode无法找到x86_64架构的符号

我试图解析一个YAML文件从我的.mm文件。我决定使用yaml-cpp库来完成这项任务。

我下载了source并将所有头文件添加到我的项目。我可以包含yaml.h头文件在我的.mm文件中,并且它已成功构建。

#include <yaml-cpp/yaml.h> 
... 

当我尝试执行sample code,用下面的语句:

std::ifstream yamlReader("vmap3_styleattrs.yaml"); 
YAML::Parser yamlParser(yamlReader); 

我收到以下错误:

Undefined symbols for architecture x86_64: 
    "YAML::Parser::Parser(std::__1::basic_istream<char, std::__1::char_traits<char> >&)", referenced from: 
    -[StyleSheetTests testGeoCSSTestAPIPrototype] in StyleSheetTests.o 
    "YAML::Parser::~Parser()", referenced from: 
    -[StyleSheetTests testGeoCSSTestAPIPrototype] in StyleSheetTests.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

有趣的是,它编译第一次,但从那以后每一次连续的尝试,构建都失败了,上面的消息。

我想知道this question是否与我的情况有关,尽管我不确定。

我会很感激任何输入。

+0

你对源文件做了什么? – immibis

+0

@immibis,我将源文件物理复制到我的项目目录,并在我的源代码中引用它们。对于例如'#include '不会抛出错误,因为我已将* yaml.h *头文件复制到项目目录中的* yaml-cpp *文件夹中。 –

回答

0

This screenshot说明在下面列出了答案:

我想你可以通过这种方法解决。

Project Setting -> Build Settings -> Apple LLVM 7.0 Language - C++ -> C++ Standard Library And Change libc++ (LLVM C++ standard library with C++11 support) to libstdc++ (GNU C++ standard library)

+0

这个改变打破了我的构建。感谢您的尝试。 –

相关问题