C++ 链接问题,好像我不能链接到标准 C++ 东西

标签 c++ linker static-linking

我正在尝试使用我自己在 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/

相关文章:

c++ - 将弱符号和局部符号链接(symbolic link)在一起时,可能的GCC链接器错误导致错误

linux - 加载共享库时,它是否可能引用当前二进制文件中的某些内容?

c++ - 在 leveldb 的包装类中链接静态方法

c++ - 为什么我不能链接到 shaderc?

c++ - 我可以使用在类构造函数中初始化的ofstream类型的成员变量吗?

c++ - 如何在OpenCV中获取Freeman链码?

c++ - _HUGE 和 __IMP__HUGE 在 "math.h"

haskell - 最小的 haskell (ghc) 程序安装(无需 ghc/cabal 进行部署)

c++ - 如何将所有抛出变成中止条件以进行调试?

c++ - 监视守护进程的状态