When I am trying to build some code which uses GTest, on my mac with the latest clang, it fails at linking with
Undefined symbols for architecture x86_64:
"testing::Message::Message()", referenced from:
parse::testing::DiffWithGoldenFile(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&) in v8test_helper.o
"testing::internal::PrintStringTo(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_ostream<char, std::__1::char_traits<char> >*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > testing::PrintToString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in v8sandbox_test.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > testing::PrintToString<char const*>(char const* const&) in v8sandbox_test.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > testing::PrintToString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in v8test_helper.o
"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<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(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&) in v8sandbox_test.o
...
Any one have ideas on fixing it?
Solved it by compiling Gtest with the flags
./configure CXX="clang++ -std=c++11 -stdlib=libc++" && make
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With