title: "Multiple definition of" C++ compiler error
body: <p>I can't seem to get rid of these seemingly random compiles errors in one of my classes.
  I get about 4 errors such as:</p>
  
  <pre><code>multiple definition of `draw_line(float, float, float, float)'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>multiple definition of `near_far_clip(float, float, float*, float*, float*, float*, float*, float*)'
  </code></pre>
  
  <p>that are flagged in the middle of the method.</p>
  
  <p>I also consistently get <code>multiple definition of `stack'</code> in the middle of another method. <code>stack</code> is a global variable in a totally different file. It isn't even mentioned in the file I'm getting the error in.</p>
  
  <p>I tried separating the error prone file into .h and .cpp files (was originally just a .cpp) and nothing about the error changed...</p>
  
  <p>I don't have duplicate methods. I only have one <code>#include</code> of lines.h and there is an <code>#ifndef</code> clause at the beginning. All these errors appear in the .cpp file.</p>
  
  <p>Any ideas what it could be?</p>
  
  <p>Alright, I got the code up:</p>
  
  <ul>
  <li><a href="http://code.bulix.org/wrmmiw-70109" rel="noreferrer">lines.cpp</a>  </li>
  <li><a href="http://code.bulix.org/l2milw-70110" rel="noreferrer">ThreeD.cpp</a>  </li>
  <li><a href="http://code.bulix.org/e50rga-70111" rel="noreferrer">ThreeD.h</a>  </li>
  <li><a href="http://code.bulix.org/3ctuqy-70112" rel="noreferrer">makefile</a>  </li>
  </ul>
  
  <p>The lines.cpp is a converted .c file I received from my instructor. I included the makefile just in case, because I always have problems with it. I also annotated exactly where the errors were flagged in the file, but they seem pretty random so I don't know if it's particularly important. I abandoned the .h file because it wasn't solving anything or helping. I believe it will be easier to find the mistake without it.</p>
  
  <p>Here is the requested <a href="http://code.bulix.org/9img79-70113" rel="noreferrer">main.cpp file</a> (there is no .h).</p>
  
  <hr>
  
  <p>I remade the lines.h file due to and I'm still receiving the:</p>
  
  <pre><code>multiple definition of `draw_line(float, float, float, float)'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>multiple definition of `near_far_clip(float, float, float*, float*, float*, float*, float*, float*)'
  </code></pre>
  
  <p>errors in the lines.cpp file, but the <code>multiple definition of `stack'</code> error is now in a random place in the ThreeD.cpp file (and is marked by a comment now). <strong>Update:</strong> This error has been fixed and the files have been revised to show this:</p>
  
  <ul>
  <li><a href="http://code.bulix.org/pl0ha3-70114" rel="noreferrer">lines.h</a></li>
  <li><a href="http://code.bulix.org/en2iiq-70124" rel="noreferrer">lines.cpp</a></li>
  <li><a href="http://code.bulix.org/ec1l4c-70125" rel="noreferrer">ThreeD.cpp</a></li>
  <li><a href="http://code.bulix.org/cm691a-70117" rel="noreferrer">ThreeD.h</a></li>
  </ul>
  
  <p>I messed around with labeling some the global variables extern, but it didn't seem to affect anything.</p>