I am possibly doing this incorrectly and this is much a question about why it works in one compiler and not the other.
I have a large C application, and I am
One piece of the idiom is missing. The forward declarations are independent from the definitions, so they should be in a separate header file.
// a_fwd.h
#ifndef A_FWD_H
#define A_FWD_H
typedef struct A_ A;
#endif
// a.h
#ifndef A_H
#define A_H
#include "a_fwd.h"
struct A_ {
};
#endif
Now it's always safe to include any headers in any order.
It is illegal to have two definitions of anything. A typedef is a definition, not just a declaration, so the one compiler was being quite lax to allow the redundancy.