title: First defined here error after inclusion of .cpp-file
body: <p>I have the following two c++ files: </p>
  
  <p>somNode.cpp:</p>
  
  <pre><code>#include &lt;random&gt;
  #include &lt;iostream&gt;
  #include &lt;chrono&gt;
  
  
  /*
  * This class represent a node in the som-grid
  */
  class somNode
  {
      private:
          // Weight of the node representing the color
          int nodeWeights[3];
          // Position in the grid
          double X, Y;
          // corner coorinates for drawing the node on the grid
          int top_Left, top_Right, bottom_Left, bottom_Right;
  
      public:
          // Constructor
          somNode(int tL, int tR, int bL, int bR)
          {
              top_Left = tL;
              top_Right = tR;
              bottom_Left = bL;
              bottom_Right = bR;
          }
  
  };
  
  
  void my_custom_function(int nodeWeights[])
  {
    // construct a trivial random generator engine from a time-based seed:
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    std::default_random_engine generator (seed);
    std::uniform_int_distribution&lt;int&gt; distribution(0,255);
    for(int i=0; i&lt;3; i++)
    {
      nodeWeights[i] = distribution(generator);
    }
  }
  </code></pre>
  
  <p>and main.cpp: </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;ctime&gt;
  #include &lt;cstdlib&gt;
  
  #include "somNode.cpp"
  
  using namespace std;
  
  int main ()
  {
      return 0;
  }
  </code></pre>
  
  <p>If I try to run this code I get: </p>
  
  <p><a href="https://i.stack.imgur.com/F8wY0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F8wY0.png" alt="enter image description here"></a></p>
  
  <p>Why do I get this error? I don't understand why the compiler complains about the inclusion? I'm a beginner in C++ programming and everything is a bit new to me x) I know I should use header files in inclusions but I'm just trying to experiment and learn the language :) </p>