title: Including .cpp files
body: <p>I have read in places like <a href="https://stackoverflow.com/questions/8836871/include-cpp-file?rq=1">here</a> that you have to include .h files and not .cpp files, because otherwise then you get an error. So for example</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "foop.h"
  
  int main(int argc, char *argv[])
  {
  int x=42;
  std::cout &lt;&lt; x &lt;&lt;std::endl;
  std::cout &lt;&lt; foo(x) &lt;&lt; std::endl;
  return 0;
  }
  </code></pre>
  
  <p>foop.h</p>
  
  <pre><code>#ifndef FOOP_H
  #define FOOP_H
  int foo(int a);
  #endif
  </code></pre>
  
  <p>foop.cpp</p>
  
  <pre><code>int foo(int a){
      return ++a;
  }
  </code></pre>
  
  <p>works, but if I replace <code>#include "foop.h"</code> with <code>#include "foop.cpp"</code> I get an error (Using Dev C++ 4.9.9.2, Windows):</p>
  
  <pre><code>multiple definition of foo(int)
  first defined here
  </code></pre>
  
  <p>Why is this? </p>