I have a weird issue in a C++ code and I cannot figure out what is going on. I know what a forward declaration is, and I know when to use them etc...
However, in a C++ project I have, I am forced to foward declare a class that has been already declared in an included header. It looks something like this
windows.h:
#ifndef WINDOWS_HH_
#define WINDOWS_HH_
#include "foo.h"
class fooC; // If I don't forward declare here, won't compile!?
class WindowC
{
public:
WindowC();
~WindowC();
public:
fooC a;
};
#endif
and then, foo.h contains the declaration of fooC
#ifndef FOO_HH_
#define FOO_HH_
class fooC
{
public:
fooC();
~fooC();
};
#endif
Any idea why this might be happening? The actual code is part of a big project and it is really difficult to figure out what the error might be... but I am sure that theoretically that forward declaration of fooC shouldn't be necessary, should it?