How do I make a C++ (shared) library compatible with clang and GCC? : <p>I've written a fairly substantial C++11 library, and I'm planning to allow download of pre-compiled versions from my website.</p>

<p>So I've set up an automated build which compiles the library with clang and make it available for download, but this has exposed a problem: if I try to use the clang-compiled library with GCC I get undefined references (mainly related to <code>std::string</code>). I think this is related to the GCC dual-ABI changes in GCC 5.1 but I'm not sure how to fix it.</p>

<p>My question is, what flags should I set, or practices should I follow to make a C++ library compatible with both clang and GCC?</p>

<p>Or should I give up and compile two separate libraries? </p>
