G ++ new problems with ABI

I am having a problem with a new ABI introduced for C ++ 11 in GCC. After upgrading to GCC 5.3, my project no longer compiles. The error messages I get are simple:

undefined reference to `tokenize(std::__cxx11::basic_string' ...more characters 

or

 undefined reference to `extract(std::string const&)' 

So it looks like I messed up something and GCC cannot decide if I want an old ABI or a new one (the __cxx11:: part is missing from some error messages and present in others)?

I tried several solutions to solve the problem:

  • passing -D_GLIBCXX_USE_CXX11_ABI=0 to GCC,
  • passing -D_GLIBCXX_USE_CXX11_ABI=1 to GCC,
  • macro setup directly in the source code,
  • setting the abi_tag attribute in ads that GCC complained about when passing the -Wabi-tag flag,

Unfortunately, none of them worked (i.e., it allowed compiling the code). The only thing I know is that only functions that return std::string or accept it as a parameter cannot communicate. Which is to be expected, given what I read about the problem on the Internet. I could not reproduce the problem in a simple sample program to present it here.

Is there an obvious solution to my problem that I am missing?

+6
source share
1 answer

This error indicates that you are referencing some code or library that was not recompiled with gcc 5.3, and was compiled with an earlier version of gcc using an earlier version of ABI.

If you are linking to some external libraries, in addition to the standard C ++ library, these external libraries must be recompiled (and reinstalled).

If you are not linking to any external libraries, and you are linking only your own code, some of your source modules should not have been recompiled yet. Recompile everything. Be sure to remove all existing object modules using make clean or the equivalent for any build system you use.

+8
source

All Articles