Boost unit test link error - abi inconsistency?

I am trying to create a unit test with boost, but the linker complains about the missing function. Take this skeletal code

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE(TestFuncOps);

BOOST_AUTO_TEST_CASE(CopyConstructor)
{
}    

BOOST_AUTO_TEST_SUITE_END();

But he fails with

Undefined symbols for architecture x86_64:
  "boost::unit_test::ut_detail::normalize_test_case_name[abi:cxx11](boost::unit_test::basic_cstring<char const>)", referenced from:
      __GLOBAL__sub_I_funcopstest.cc in funcopstest.o

libboost_unit_test_framework is in my linker command:

g++-5 --std=c++14 funcopstest.o -L/usr/local/lib -lboost_unit_test_framework -o test_funcops

because, taking away -lboost_unit_test_framework, I get a ton of undefined links instead of one. Boost was installed through brewfrom a source using C ++ 11. I tried to compile with each -fabi-version=[0-8], but nothing changed.

Does anyone know what is going on?

+4
source share
1 answer

Add -D_GLIBCXX_USE_CXX11_ABI=0to your CPPFLAGS, and then recompile.

libstd++, gcc 5, std::string std::list ++ 11. ABI, ABI.

libboost_unit_test_framework.so, -, (, gcc 4.x), , , , , . , ABI , . _GLIBCXX_USE_CXX11_ABI 0 gcc 5 .

Boost.Test gcc 5.

+7

All Articles