title: Refactoring leads to linker issue with duplicates
body: <p>I wish to have some wrapper code be a header-only library. I was inspired by the boost libraries to keep them header only to uncomplicate the need for distributing .lib's and including compiling .cpp's. </p>
  
  <p>In this example "z.h" is the wrapper and a.cpp has been refactored to move B() into it's own source file. Now it doesn't work.</p>
  
  <p>z.h</p>
  
  <pre><code>class Z
  {
      public:
      void Foo(); // edited to match my code
  };
  
  Z::Foo() { } 
  </code></pre>
  
  <p>a.cpp</p>
  
  <pre><code>#include "z.h"
  void A() { 
        Z z;
        z.Foo();
  }
  //void B(Z z) {
  //     z.Foo();
  //}
  </code></pre>
  
  <p>b.cpp</p>
  
  <pre><code>#include "z.h"
  void B(Z z) {           
        z.Foo();
  }
  </code></pre>
  
  <p>*error LNK2005: "public: __cdecl void z::Foo()" already defined in b.obj*</p>
  
  <p>I know I can fix this by separating out z.h into z.h for declarations and z.cpp for definitions. </p>
  
  <ul>
  <li>But how can Boost libraries get away without .cpp files?</li>
  <li>Does everything need to be a template?</li>
  <li>What code can go in z.h?</li>
  </ul>