Vector class help
I''m using the VECTOR class from one of the NeHe lessons. It has all arithmetic operators overloaded, but when I try to do:
vec1 = vec2 - vec3;
I tells me undefined reference to VECTOR::operator-(VECTOR const&). The operators are defined as inline, but I don''t really think that has anything to do with it. I also added an operator= so that I could do the assignment.
Help?
Thanks
With inline operators, I don''t think you can prototype them in a class, I think you hae to do like this:
class VECTOR {
public:
...
...
inline operator-(VECTOR v) { ... }
And not
class VECTOR {
public:
...
...
inline operator-(VECTOR v);
And then in another file:
inline operator-(VECTOR v) { ... }
class VECTOR {
public:
...
...
inline operator-(VECTOR v) { ... }
And not
class VECTOR {
public:
...
...
inline operator-(VECTOR v);
And then in another file:
inline operator-(VECTOR v) { ... }
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement