Undefined reference
<p><br>
I'm having troubles to compile my C++ project because I get an Undefined reference error.<br>
I have 2 classes:  </p>

<p>Vector3.h  </p>

<pre><code>class Vector3  
{  
public:
float x, y, z;
float v[3];  
Vector3();  
Vector3(float x, float y, float z);  
float mag();  
void normalize();  
void invert();  
void assign(float x, float y, float z);  
Vector3&amp; operator += (const Vector3&amp; in);  
Vector3&amp; operator -= (const Vector3&amp; in);  
Vector3&amp; operator *= (const float&amp; in);  
Vector3&amp; operator /= (const float&amp; in);  
Vector3 operator - ();  
static const Vector3 vZero;  
}; 
</code></pre>

<p>Vector3.cpp  </p>

<pre><code>#include "Vector3.h"

inline void Vector3::assign(float inx, float iny, float inz)  
{  
x = inx;  
y = iny;  
z = inz;  
}  

inline float Vector3::mag()  
{  
return (float)sqrt( (*this) * (*this));   
}  

inline void Vector3::normalize()  
{  
float invMag = 1.f/mag();     
(*this) *=  invMag;  
}  
</code></pre>

<p>Ray.h  </p>

<pre><code>#include "Vector3.h"  

class Ray  
{  

public:  
Vector3 origin;  
Vector3 direction;  
Vector3 destination;  
float distance;  

Ray();  
Ray( Vector3 o, Vector3 d);  
void setOrigin(float x, float y, float z);  
void setOrigin(const Vector3&amp; v);  
void findDirection(void);  
void setDestination(float x, float y, float z);  
void setDestination(const Vector3&amp; v);  
void findDestination(void);  
void setDirection(const Vector3&amp; v);  
void normalizeDirection(void);  
};  
</code></pre>

<p>Ray.cpp  </p>

<pre><code>#include "Ray.h"  

void Ray::findDirection(void)  
{  
direction = destination - origin;  
distance = direction.mag();  
direction.normalize();  
}
</code></pre>

<p>When I compile it using Eclipse IDE I get:  </p>

<pre><code>/Ray.cpp:39: undefined reference to `Vector3::mag()'  
/Ray.cpp:40: undefined reference to `Vector3::assign(float, float, float)'  
/Ray.cpp:41: undefined reference to `Vector3::normalize()'  
</code></pre>

<p>The header files are included and the auto complete tool works OK, it shows (recognize) the methods: mag, assign and normalize.  </p>

<p>I compiled the files using "g++ -c" to create the .o files because eclipse didn't find them. But the error is still there.  </p>

<p>Does anyone know a solution for this problem?  </p>

<p>Please note that the files Vector3.cpp and Ray.cpp only show the code related to this problem.</p>

<p>Thanks for your help!  </p>
