Xcode无法找到x86_64架构的符号

时间:2016-06-01 01:20:37

标签: c++ objective-c xcode linker

我是Objective-C和Xcode的新手。

我正在尝试从 .mm 文件中解析 YAML 文件。我决定使用yaml-cpp库来完成这项任务。

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

#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是否与我的情况有关,虽然我不确定。

我很感激任何投入。

1 个答案:

答案 0 :(得分:-1)

This screenshot说明了以下概述的答案:

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

  

项目设定 - &gt;构建设置 - &gt; Apple LLVM 7.0语言 - C ++ - &gt; C ++标准库   并将libc++ ( LLVM C++ standard library with C++11 support)更改为libstdc++ (GNU C++ standard library )