C++ のリンクの問題です。標準の C++ とはリンクできないようです。質問する

C++ のリンクの問題です。標準の C++ とはリンクできないようです。質問する

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)

ベストアンサー1

皆さん、回答をありがとうございました。自分の問題が何だったのかがわかったので、他の人も同じ問題に遭遇した場合に備えてここで共有します。

私の問題は、プロジェクトのビルド設定でした。「Apple LLVM Compiler 5.0 - Language - C++」の下に「C++ standard library」の設定があります。その値を「Compiler Default」に変更する必要がありました。

数時間は無駄になりましたが、問題は解決しました!

おすすめ記事