title: How to handle dual ABI in GCC 5?
body: <p>I try to understand how to overcome problems with the dual ABI introduced in GCC 5. However, I don't manage to do it. Here is a very simple example to reproduce errors. The version of GCC I use is 5.2. As you can see, my main function (in main.cpp file) is quite simple:</p>
  
  <pre><code>// main.cpp
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  int main()
  {
      std::string message = "SUCCESS!";
      std::cout &lt;&lt; message &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>When I type</p>
  
  <pre><code>/home/aleph/gcc/5.2.0/bin/g++ main.cpp
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <pre><code>/tmp/ccjsTADd.o: In function `main':
  main.cpp:(.text+0x26): undefined reference to `std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;)'
  main.cpp:(.text+0x43): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)'
  main.cpp:(.text+0x5c): undefined reference to `std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  main.cpp:(.text+0x8c): undefined reference to `std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  collect2: erreur: ld a retourné 1 code d'état d'exécution
  </code></pre>
  
  <p>If I change the value of <code>_GLIBCXX_USE_CXX11_ABI</code> to 0, the problem disappears. </p>
  
  <p>But, how to make things work with the default ABI?</p>
  
  <p>EDIT: simpler question (removed cmake script)</p>