20

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

但是,当我尝试在我的应用项目中链接此库时,应用无法链接。链接错误让我感到惊讶;似乎 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)
4

5 回答 5

28

谢谢大家的回答。我发现了我的特殊问题,所以会在这里分享,以防其他人遇到它。

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

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

于 2012-10-12T03:58:29.933 回答
8

我正在使用更新版本的 iOS SDK 并将“构建设置 > Apple LLVM 5.0 - 语言 - C++ > C++ 标准库”设置为“编译器默认值”,但出现 46 个编译错误。

我通过将其设置为“libstdc++(GNU C++ 标准库)”消除了这些错误。

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

于 2013-12-09T20:37:26.053 回答
1

不确定这是否对任何人都有帮助,但是当我有一个与其他项目链接的项目时,我遇到了同样的问题,一个项目的 Base SDK 为 5.1,另一个项目的 Base SDK 为 7.0。

于 2014-02-04T16:25:33.097 回答
0

也许您没有适用于 armv7 架构的 SDK,因此您可以编译您的代码,但安装在您计算机上的标准 C++ 内容适用于另一种架构(例如 x86),并且您的链接器找不到该架构所需的库

于 2012-10-11T22:53:37.153 回答
-1

链接错误提示在路径中找不到c++库。如果没有更多信息,我建议检查 c++ 库的路径是否正确。

于 2012-10-11T22:43:30.097 回答