Circular dependency / Compile Error
Hello all!
I'm trapped trying to compile the following (suposing) code.
I have a class A that uses B objects. And the class B uses A objects.
The compiler( Bcc32.exe ) generates an error because, while trying to compile A.cpp, it reads the A.h
A.h has the "#include B.h", so it reads B.h
B.h has the "include A.h", but it doesn't read it again, parsing the file until it gets the "void doThat( A& a )". There is a object "a" of the class "A" that wasn't (full) parsed yet, so it prints something like:
error: " ")" expected"
/*--------------class A----------------*/
//File A.h
#include "B.h"
class A
{
public:
void set( B b );
};
//----EOF---
//file A.cpp
#include "A.h"
void A::set( B b ) { /* code */ }
//----EOF---
/*--------------class B----------------*/
//file B.h
#include "A.h"
class B
{
public:
void doThat( A& a );
};
//----EOF----
//file B.cpp
#include "B.h"
void B::doThat( A& a ) { /* code */ }
//----EOF---
Thanks
Jester