This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

help #include

a.h:
struct A {
   int a;
};

b.h:
struct B {
   struct A ba;
};

c.c:
#include "a.h"
#include "b.h"

</prev>

compiler complains struct A in file b.h is undefined.  I would think that by include a.h before b.h in c.c, it would see the struct A definition?

I know I could make it compile by adding:
struct A; in b.h but just want to know why it doesn't work the way above.

Thanks,

Anh

0