I'm having 2 .h files ( with .cpp files ) that has code like that:
Foo:
#ifndef INCLUDE_FOO_H_
#define INCLUDE_FOO_H_
class Foo
{
public:
virtual ~Foo();
virtual void workWithBar(Bar* bar);
};
#endif /* INCLUDE_FOO_H_ */
Bar:
#ifndef INCLUDE_BAR_H_
#define INCLUDE_BAR_H_
class Bar
{
public:
virtual ~Bar();
virtual void letsWorkWithFoo(Foo* itsFoo);
};
class Bar2 : public Bar
{
public:
virtual void letsWorkWithFoo(Foo* itsFoo);
};
#endif /* INCLUDE_BAR_H_ */
cpp files are just simple files , with "empty" impl. of that code. I'm using latest Eclipse , and latest MinGW that i could find. Both of cpp files include and . If i put all that classes together , it would compile and work fine. And i'm using Foo.h in main.cpp too , and its working perfect too.
I did try adding include into Foo & Bar , i did try using diffrent std(-std=c++11). I'm not using "using namespace" anywhere in .h files.
p.s. if you didnt undestend it from title -
C:\PathWasHere\include/Bar.h:35:21: error: 'Foo' has not been declared
virtual void workWithFoo(Foo *Foo);
^
C:\PathWasHere\include/Bar.h:86:21: error: 'Foo' has not been declared
virtual void workWithFoo(Foo *Foo);
^
edit: forgot to say , i'm working with Bar in Foo too.