Google Testのリンクエラーの対応
Google Testでよくわからないリンクエラーにハマってしまったので、備忘録を残します。
開発環境は
Xcode 5.0.2
Gootle Test 1.7.0
この環境で、ASSERT_EQを呼び出してビルドすると以下のようなリンクエラーが出てしまいました。
Undefined symbols for architecture x86_64: "testing::internal::EqFailure(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)", referenced from: testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&) in CollisionTest.o
Google Testのライブラリをビルドした環境は、ダウンロードしたファイルのまま何も変更しておらず
サンプルコードも実行できています。
しばらく試行錯誤してみたのですが、最終的にこちらのサイトを参考にさせていただいて、解決しました。
自分の場合は、C++ Standerd Libraryの値をComplier Defaultではなく、libstdc++にしたらリンクが通りました。
これでようやく開発の続きができます。