title: Can a define be made across all translation units?
body: <p>Can a #define or similar pre-processor definition be made across all translation units?</p>
  
  <p>Header implementations are useful for really small libraries since all the code can be contained and distributed with a single header with the following structure:</p>
  
  <pre><code>// library.h
  
  void libFunc(); // forward decl
  
  #ifdef IMPLEMENT_LIBRARY
  int libState;
  volatile int libVolState; // library state exposed to external processes
  void libFunc(){
      // definition
  }
  #endif
  </code></pre>
  
  <p>This structure however requires the user to define <code>IMPLEMENT_LIBRARY</code> before the header's inclusion in only one of their translation units, meaning it can't be put in the user's header files, and might be a little confusing to someone who isn't wholely familiar with C++'s compilation rules.</p>
  
  <p>If there were a way to define <code>IMPLEMENT_LIBRARY</code> across all TU, this could be done automatically with</p>
  
  <pre><code>#ifndef IMPLEMENT_LIBRARY
  #defineToAllUnits IMPLEMENT_LIBRARY
  // library state
  // definitions
  #endif
  </code></pre>
  
  <p>Does such a mechanism exist, or is the current single-header system as good as it's gonna get?</p>