C++链接问题,似乎我无法链接标准C++的东西

D.C*_*.C. 20 c++ linker static-linking

我正在尝试使用我在iOS应用程序中编译自己的库.该库是Tesseract OCR库.似乎编译(及其依赖)已经好了.

但是,当我尝试在我的应用程序项目中链接此lib时,该应用程序无法链接.链接错误让我感到惊讶; 好像Tesseract找到相当标准的C++东西有问题.

关于我可能做错的任何建议都会有所帮助.

这是我看到的那种链接错误的片段.

Undefined symbols for architecture armv7:
"std::string::find_last_of(char const*, unsigned long) const", referenced from:
  tesseract::WordSizeModel::Init(std::string const&, std::string const&) in    libtesseract.a(word_size_model.o)
"std::string::find_first_of(std::string const&, unsigned long) const", referenced from:
  tesseract::CubeUtils::SplitStringUsing(std::string const&, std::string const&, std::vector<std::string, std::allocator<std::string> >*) in libtesseract.a(cube_utils.o)
"std::string::find_first_not_of(std::string const&, unsigned long) const", referenced from:
  tesseract::CubeUtils::SplitStringUsing(std::string const&, std::string const&, std::vector<std::string, std::allocator<std::string> >*) in libtesseract.a(cube_utils.o)
"std::string::data() const", referenced from:
  tesseract::CubeUtils::SplitStringUsing(std::string const&, std::string const&, std::vector<std::string, std::allocator<std::string> >*) in libtesseract.a(cube_utils.o)
"std::string::find(char, unsigned long) const", referenced from:
  tesseract::TessLangModel::IsLeadingPunc(int) in libtesseract.a(tess_lang_model.o)
Run Code Online (Sandbox Code Playgroud)

D.C*_*.C. 28

谢谢大家的答案.我发现了我的特殊问题,所以如果有其他人点击它,我会在这里分享.

我的问题是项目构建设置.在"Apple LLVM Compiler 5.0 - Language - C++"下,有一个"C++标准库"的设置.其值需要更改为"编译器默认值".

浪费了几个小时,但问题解决了!


Ten*_*Jay 8

我使用的是更新版本的iOS SDK,并将"Build Settings> Apple LLVM 5.0 - Language - C++> C++标准库"设置为"Compiler Default",但得到了46个编译错误.

我通过将其设置为"libstdc ++(GNU C++标准库)"来消除错误.

希望这可以帮助任何在使用"编译器默认"时遇到困难的人.