title: When do I need to #include .cpp files?
body: <p>One of my homeworks involves three files: LineType.h, LineType.cpp, and Driver.cpp. Driver.cpp contains the main() method which uses a class defined by LineType.h and LineType.cpp.</p>
  
  <p>On my system, Driver.cpp starts with:</p>
  
  <pre><code>#include "LineType.h"
  #include "LineType.cpp"
  #include &lt;iostream&gt;
  </code></pre>
  
  <p>And the program compiles and runs perfectly when I run <code>g++ Driver.cpp</code> from within the project directory via the command line. However, when my instructor attempts to compile the program (I believe she uses Eclipse), it fails to compile. After some back-and-forth, she was able to fix the problem on her end by commenting out one of the #includes from Driver.cpp:</p>
  
  <pre><code>#include "LineType.h"
  //#include "LineType.cpp"
  #include &lt;iostream&gt;
  </code></pre>
  
  <p>When I attempt to run <code>g++ Driver.cpp</code> on this edited file, my compiler complains about "Undefined symbols for architecture", which I understand to mean that it cannot find definitions for the class/methods being called.</p>
  
  <p>What are my instructor and I doing differently to cause this difference in behavior? Why does a line required by my compiler cause her compiler to fail?</p>