title: C++ weird problem, Undefined reference
body: <p>getting error: neljastest.cpp: undefined reference to Vector2::Vector2(float, float)</p>
  
  <p>neljastest.cpp:</p>
  
  <pre><code>    #include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include "../include/Vector2.h"
  #include "../include/neljas.h"
  
  using namespace std;
  
  int main (int argc, char* argv[]) {
       Vector2 p1 (1.0, 2.0);
       Vector2 p2 (0.0, 0.0);
       Vector2 p3 (5.0, 2.0);
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>vector2.h:</p>
  
  <pre><code>#ifndef VECTOR2_H
  #define VECTOR2_H
  
  #include &lt;iostream&gt;
  using std::ostream;
  
  class Vector2 {
  
  public:
      float x;
      float y;
  
      Vector2();
  
      Vector2(float nx, float ny);
  
      float distanceFrom(Vector2 v);
  
  
  };
  
  
  ostream&amp; operator &lt;&lt; (ostream&amp; valja, Vector2 v);
  
  #endif
  </code></pre>
  
  <p>vector2.cpp:</p>
  
  <pre><code>    #include "../include/Vector2.h"
  #include &lt;cmath&gt;
  
  using namespace std;
  
  Vector2::Vector2() {
      x = 0;
      y = 0;
  }
  
  Vector2::Vector2(float nx, float ny) {
      x = nx;
      y = ny;
  }
  
  float Vector2::distanceFrom(Vector2 v) {
      return sqrt( (x - v.x)*(x - v.x) + (y - v.y)*(y - v.y) );
  }
  
  ostream&amp; operator &lt;&lt; (ostream&amp; os, Vector2 v) {
      return os &lt;&lt; "(" &lt;&lt; v.x &lt;&lt; "," &lt;&lt; v.y &lt;&lt; ")";
  }
  </code></pre>