title: Is it safe to link to a static library built with different compiler flags
body: <p>I use GoogleTest for testing my C++ projects, and after finding that precompiled libraries were no longer distributed in the Ubuntu package, I found the following on the project website:</p>
  
  <blockquote>
    <p>If you compile Google Test and your test code using different compiler
    flags, they may see different definitions of the same
    class/function/variable (e.g. due to the use of #if in Google Test).
    Therefore, for your sanity, we recommend to avoid installing
    pre-compiled Google Test libraries. Instead, each project should
    compile Google Test itself such that it can be sure that the same
    flags are used for both Google Test and the tests.</p>
  </blockquote>
  
  <p>What I take from this is that it's a bad idea to compile GoogleTest separately from the project being testing. What I don't understand is whether this is just a GoogleTest thing, or if this is a general thing for linking libraries.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is there any situation in which it is unsafe to link to precompiled third-party libraries, compiler flags or otherwise, and if not, what's so special about GoogleTest?</p>