i spotted a little problem, you're enclosing the headers you made with angel brackets.
you use angle brackets to specify standard library headers.
your own made headers should be placed in double quotations, maybe this is your problem.
try using: #include "apple.h"
and #include "pear.h"
hi, I think i should have clarified my question a bit more.
example of the kind of problem I'm having:
--- this is from main.cpp ---
1 2
#include "pear.h"
...
--- this is from sub.cpp ---
1 2
#include "pear.h"
...
--- this is from pear.h ---
1 2 3 4 5
#include "apple.h"
class pear
{
apple apple_object_in_pear;
};
--- this is from apple.h ---
class apple { ... };
the problem is when I include pear.h in both sub.cpp and main.cpp - everything in apple.h gets redefined and i get an error.
For variables I could work around this by using extern but I don't know how i can do it for classes