我正在尝试使用我自己在 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)
最佳答案
谢谢大家的回答。我发现了我的特殊问题,所以会在这里分享,以防其他人遇到它。
我的问题是项目build设置。在“Apple LLVM Compiler 5.0 - Language - C++”下有一个“C++ 标准库”的设置。需要将其值更改为“编译器默认值”。
浪费了几个小时,但问题解决了!
关于C++ 链接问题,好像我不能链接到标准 C++ 东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12849517/