I've got two header files, each requiring a type defined in the other. When I try to compile, I get an error regarding an unknown type name. (If I provide only struct declarations and not definitions, I get an incomplete-types error.) What's a solution that will let me share these structs properly?
Right now, my code looks rather like the following (just imagine the #ifndef
preprocessor directives etc.):
<headerA.h>
#include "headerB.h"
typedef struct {
mytypeB myB;
} mytypeA;
<headerB.h>
#include "headerA.h"
typedef struct {} mytypeB;
void foo( mytypeA * myA);