部署目标为7.0时,体系结构错误的未定义符号 [英] Undefined symbols for architecture error when deployment target is 7.0
问题描述
我在我的原生iOS应用程序(一堆.a库)中使用第三方框架。我的应用程序是使用XCode 5基础SDK 7.0开发的。
I am using third party frameworks in my native iOS application (bunch of .a libraries). My application is developed with XCode 5 base SDK 7.0.
当部署目标为6.1(库和标题搜索路径良好)时,库可以编译和链接。但是,当我将部署目标更改为7.0时,我收到以下链接器错误:
The libraries compile and link fine when the deployment target is 6.1 (library and header search paths are good). However, when I change the deployment target to be 7.0, I get the following linker error:
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。任何类型的帮助/方向都会很棒。
Libraries are a bit old, I am not sure if there is a compatibility issue. I am not planning to support iOS 6 so I need to set the deployment target as 7.0. Any kind of help/direction would be great.
推荐答案
事实证明,如果XCode找不到任何C ++文件项目,然后它假定不需要libstd ++。因此,您必须手动将C ++文件添加到项目中(空的.mm文件就足够了)。这就是解决方案。
It turns out that if XCode can't find any C++ files in the project, then it assumes that libstd++ is not required. So, you have to manually add a C++ file to the project (an empty .mm file would be enough). That is the solution.
所有学分转到答案在此 Stackoverflow主题中。
这篇关于部署目标为7.0时,体系结构错误的未定义符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!