Ooo, good catch, Tanner. I bet if we saw a "stack trace" of the syntax
error, it'd be something along the lines of..
"In file included from point3d.h (vector3d.h):
In file included from vector3d.h (point3d.h):
In file point3d.h:
Syntax error, expected identifier yadda yadda yadda"
I believe Tanner is right about the forward declaration being one
solution, as well as it being a good indication that you may want to
rethink your class design/heirarchy.
Of course, my geometry skills are very faded at this point, but can you
really subtract a point from a vector? I wouldn't know how to do that.
In my ignorance of geometric operations, I'd suggest removing the
operator-(point3d) function altogether. That's the only member of
vector3d (such as it is now) that has a reference to point3d. If you
really need the function, maybe make a reverse-logic member function of
point3d such as vector3d subtractFrom(vector3d) which would subtract
itself from a vector and return the resultant vector.
Cheers,
~Brian
Tanner Lovelace wrote:
On 1/31/06, Randy Barlow <[EMAIL PROTECTED]> wrote:
Thanks Brian (and Tanner!) This was definitely an issue in my code, but
I'm still having problems with the vector3d identifier in my point3d.h file.
Here is point3d.h:
#pragma once
#include "vector3d.h"
[...snip...]
line in the code above. Here is vector3d.h:
#pragma once
#include "point3d.h"
There's your problems. You've told the compiler to only include
things once and then gone and included them in each other.
That's most definitely *not* going to work because, although
the #pragma stops the infinite recursion of includes, you reference
them from each class so one of the classes will be defined before
the other and won't know anything about the other. You could try
adding a forward declaration, but I really think you should just
bit the bullet and rethink your code.
Cheers,
Tanner
--
Tanner Lovelace
clubjuggler at gmail dot com
http://wtl.wayfarer.org/
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.
--
----------------
Brian A. Henning
strutmasters.com
336.597.2397x238
----------------
--
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/