title: How do you declare a object that can be accessed through multiple header files?
body: <p>I'm working on a project and I am cleaning my code and Re-doing the code so it's more readable and easy to tweak. I'm having one issue though when I create an object in a header file the complier throws me an error saying its already defined; int assumed. LNK-2005. </p>
  
  <p>I tried creating the objects as 'extern' so I could access the objects from all files that include the file with the specified objects.</p>
  
  <pre><code>// HeaderA.h
  #include &lt;Windows.h&gt;
  
      struct ProcessInfo
      {
           int ProcID;
  
           HANDLE Handle;
  
      };
  </code></pre>
  
  <p>This is header B below</p>
  
  <pre><code>// Header B starts here
  // HeaderB.h
  #include "HeaderA.h"
  {
      ProcessInfo pi;
      pi.ProcID = 10;
  
  
      struct Player
      {
          int health = 0;
  
          float x, y, z;
  
          int score = 0;
      }
  }
  </code></pre>
  
  <p>Header C
  This file should be able to use Header B's object 'pi'</p>
  
  <pre><code>//HeaderC.h
  #include "HeaderB.h"
  
  // creating object from headerB 
  Player player;
  
  // is there a way so I can use the object declared in HeaderB in HeaderC?
  // like so
  pi.ProcID = 45;
  </code></pre>
  
  <p>I expected to be able to use the object created in header B through multiple files like HeaderB-HeaderZ. (A-Z; Multiple Headers) But when compiling I get the error "LNK2005 already defined".</p>