title: c++ multi defined symbol
body: <p>So I have this dll that holds some functions for my program. Called gc.dll I have it as a reference in my main project. In my main project I have 2 headers and 2 source files,</p>
  
  <pre><code>dx9d3d.h
  main.h
  
  
  main.cpp
  dx9d3d.h
  </code></pre>
  
  <p>Heres my includes on each file</p>
  
  <pre><code>dx9d3d.h:
  #include "gc.h"
  
  
  dx9d3d.cpp:
  #include "dx9d3d.h"
  
  main.h:
  #include &lt;Windows.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include "basics.h"
  #include "dx9d3d.h"
  
  main.cpp:
  #include "main.h"
  </code></pre>
  
  <p>I keep getting the linker error for multi defined symbols for the d3ddevice and directx symbols I have in my gc.h. I have no idea how I can include gc.h to dx9d3d.h without it being a multi defined symbol :/ please help im kindof a noob to these linker errors.</p>
  
  <p>and heres the code inside gc.h</p>
  
  <pre><code>namespace xaD3D {
  __declspec(dllexport) LPDIRECT3D9 d3d;
  __declspec(dllexport) LPDIRECT3DDEVICE9 d3dDev;
      __declspec(dllexport) bool initD3D(HWND hWnd);
  }
  </code></pre>
  
  <p>and heres the errors</p>
  
  <pre><code>2&gt;main.obj : error LNK2005: "struct IDirect3DDevice9 * xaD3D::d3dDev" (?                     d3dDev@xaD3D@@3PAUIDirect3DDevice9@@A) already defined in dx9d3d.obj
  2&gt;main.obj : error LNK2005: "struct IDirect3D9 * xaD3D::d3d" (?     d3d@xaD3D@@3PAUIDirect3D9@@A) already defined in dx9d3d.obj  
  </code></pre>