In my code I have 2 classes declared in header "Geometry.h", Vector
& Point
. Inside Point
class, I have following:
class Point {
// other stuff
friend Vector operator-(const Point& lhs, const Point& rhs);
}
Vector
is defined in "Vector.cpp" & Point
is defined in "Point.cpp".
My compiler (GCC) complains about this and I don't know why:
undefined reference to `Geometry::operator-(Geometry::Point const&, Geometry::Point const&)'|
Definition of function in "Point.cpp" looks like this:
Vector operator-(const Point& lhs,
const Point& rhs)
{
return Vector(lhs.GetX()-rhs.GetX(),lhs.GetY()-rhs.GetY());
}