title: Linker error for multiply defined symbols
body: <p>I have the following file structure:</p>
  
  <p><strong>X.h</strong></p>
  
  <pre><code>#pragma once
  
  #include "Y.h"
  
  int ONE = 1;
  
  int combine();
  </code></pre>
  
  <p><strong>X.c</strong></p>
  
  <pre><code>#include "X.h"
  
  int combine()
  {
      return ONE + TWO;
  }
  </code></pre>
  
  <p><strong>Y.h</strong></p>
  
  <pre><code>#pragma once
  
  int TWO = 2;
  </code></pre>
  
  <p><strong>Y.c</strong></p>
  
  <pre><code>#include "Y.h"
  </code></pre>
  
  <p><strong>Main.c</strong></p>
  
  <pre><code>#include "X.h"
  
  int main()
  {
      int fusion = combine();
  
      return 0;
  }
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <pre><code>LNK1169 one or more multiply defined symbols found
  
  LNK2005 _ONE already defined in Main.obj
  
  LNK2005 _TWO already defined in Main.obj
  
  KLNK2005 _TWO already defined in Main.obj
  </code></pre>
  
  <p>This makes zero sense. If we start at <code>Main.c</code> the compiler must include <code>X.h</code>. The compiler then looks for the C file associated with <code>X.h</code>. Inside <code>X.c</code> it needs to include <code>X.h</code> but <code>#pragma once</code> <em>SHOULD</em> guard against that. Then it needs to include <code>Y.h</code>. It looks for the C file and finds <code>Y.c</code> which says to include <code>Y.h</code>, but <code>Y.h</code> has already been included. Then, it returns to Main.c and should successfully compile... but nope. </p>
  
  <p>I can add <code>/FORCE</code> to my project settings which makes my code run perfectly but still outputs the:</p>
  
  <p><code>ONE has already been defined, second definition ignored.</code> </p>