I am trying to figure out how to overcome the problems with the double ABI introduced in GCC 5. However, I have failed. Here is a very simple example for reproducing errors. The version of GCC that I am using is 5.2. As you can see, my main function (in the main.cpp file) is pretty simple:
#include <iostream>
#include <string>
int main()
{
std::string message = "SUCCESS!";
std::cout << message << std::endl;
}
When i type
/home/aleph/gcc/5.2.0/bin/g++ main.cpp
The following error message appears:
/tmp/ccjsTADd.o: In function `main':
main.cpp:(.text+0x26): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
main.cpp:(.text+0x43): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
main.cpp:(.text+0x5c): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
main.cpp:(.text+0x8c): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
collect2: erreur: ld a retourné 1 code d'état d'exécution
If I change the value _GLIBCXX_USE_CXX11_ABI
to 0, the problem will disappear.
But how to make work work with ABI by default?
EDIT: simpler question (remote cmake script)
Aleph source
share