2016-06-01 50 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

這個改變打破了我的構建。感謝您的嘗試。 –

相關問題