部署目标为7.0时,架构错误的未定义符号

我在我的本地iOS应用程序(一堆.a库)中使用第三方框架。 我的应用程序是使用XCode 5 SDK 7.0开发的。

当部署目标是6.1(库和头searchpath是好的)时,这些库编译并链接正常。 但是,当我将部署目标更改为7.0时,出现以下链接器错误:

Undefined symbols for architecture i386: "std::string::find_last_of(char const*, unsigned long) const", referenced from: GetExecutionDir(ECTemplateString<char>&, char*, bool) in myLibrary.a(moPlatForm.o) "std::string::find(char const*, unsigned long) const", referenced from: ParseLog(std::string const&, unsigned int&, CmoDateTime&, int&, std::string&) in myLibrary.a(AppLog.o) "std::string::size() const", referenced from: mo::CmoParam::WriteToStream(void*, mo::STREAM_STATE*) in myLibrary.a(moParams.o) "std::string::c_str() const", referenced from: GetExecutionDir(ECTemplateString<char>&, char*, bool) in myLibrary.a(moPlatForm.o) CMocaFileTransfer::UpdateParamsForGetTraceFiles(mo::CmoParamList&, long) in myLibrary.a(RobieFileTransfer.o) CMocaFileTransfer::AddTraceFileForUpload(std::string const&, std::string const&) in myLibrary.a(RobieFileTransfer.o) CMocaFileTransfer::CreateParamsForSendTraceFiles(mo::CmoObject&) in myLibrary.a(RobieFileTransfer.o) mo::CmoParam::WriteToStream(void*, mo::STREAM_STATE*) in myLibrary.a(moParams.o) ParseLog(std::string const&, unsigned int&, CmoDateTime&, int&, std::string&) in myLibrary.a(AppLog.o) CAppLog::LogExists(unsigned int) in myLibrary.a(AppLog.o) ... 

图书馆有点老,我不确定是否存在兼容性问题。 我不打算支持iOS 6,所以我需要将部署目标设置为7.0。 任何一种帮助/方向都会很棒。

对我来说,包括' stdc ++。6.0.9.dylib '而不是' stdc ++。dylib '进入依赖关系,也解决了链接器错误

事实certificate,如果XCode在项目中找不到任何C ++文件,那么它假定libstd ++不是必需的。 所以,你必须手动添加一个C ++文件到项目中(一个空的.mm文件就足够了)。 这是解决scheme。

所有的信用在这个Stackoverflow线程去这个答案 。

看起来好像myLibrary.a是通过调用C ++代码构build的,并使用libstdc ++作为其C ++标准库。 您的应用程序项目可能会指定libc ++,也许是编译器的默认值。

尝试切换回libstdc ++,看看错误是否消失(或至less改变)。 您最终的解决scheme可能是针对新标准库构build的库。