title: class in header file gives undefined reference error
body: <p>I am new in c++ and have a problem that I could not solve. I wrote a very simple class and put it in a header file. Below are the files:</p>
  
  <p>point.h:</p>
  
  <pre><code>// point.h
  #include &lt;iostream&gt;
  
  #ifndef _POINT_H_
  #define _POINT_H_
  using namespace std;
  
  class Point{
      private:
          double x;
          double y;
      public:
          void generate(double a, double b);
          void print();
  };
  #endif 
  </code></pre>
  
  <p>point.cpp:</p>
  
  <pre><code>// point.cpp
  #include &lt;iostream&gt;
  #include "point.h"
  using namespace std;
  
  void Point::generate(double a, double b) {
      x = a;
      y = b;
  } 
  
  void Point::print() {
      cout &lt;&lt; x &lt;&lt; endl;
      cout &lt;&lt; y &lt;&lt; endl;
  }
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>// main.cpp
  #include &lt;iostream&gt;
  #include "point.h"
  using namespace std;
  
  int main() {
      Point A;
      A.generate(1,2);
      A.print();
      return 0; 
  }
  </code></pre>
  
  <p>Every time I compile main.cpp I get the error:</p>
  
  <pre><code>main.cpp:(.text+0x30): undefined reference to `Point::generate(double, double)'
  main.cpp:(.text+0x3c): undefined reference to `Point::print()'
  [Error] ld returned 1 exit status
  </code></pre>
  
  <p>What have I done wrong? Hope for answers ;).</p>
  
  <p>Greetings,
  Gerald</p>