Posted By: Superku
structs A <-> B: forward declaration? - 11/26/16 19:50
Hello!
I have two structs, like this:
struct A now needs a forward declaration of struct B (right?). No matter what I write, the lite-C compiler only gives me error messages (for example a simple "struct B;" results in "B (Struct) undeclared identifier" in the same line).
The only workaround I can think of right now is using a void pointer in A. Any ideas/ what am I doing wrong?
EDIT:
Does it do any harm if I declare/ define struct B first with let's say one dummy member, then define it differently some lines later? Does not work. Second definition is ignored.
I have two structs, like this:
Code:
[???] struct A { int x; struct B *b; }; struct B { int y; [...] struct A *a; };
struct A now needs a forward declaration of struct B (right?). No matter what I write, the lite-C compiler only gives me error messages (for example a simple "struct B;" results in "B (Struct) undeclared identifier" in the same line).
The only workaround I can think of right now is using a void pointer in A. Any ideas/ what am I doing wrong?
EDIT:
Does it do any harm if I declare/ define struct B first with let's say one dummy member, then define it differently some lines later? Does not work. Second definition is ignored.