Because of how you’ve ordered your includes, the compiler sees void some_func(my_structure *x); before it sees typedef struct abcd { int a; } my_structure;.
Let’s walk this through.
Assuming my_struct.h is processed first, we get the following sequence of events:
UTILSHis definedMAINHis defined- Because
UTILSHis already defined, we don’t processmy_struct.hagain, so the typedef isn’t processed void some_func(my_structure *x);is processed.- Now the
typedefis processed.
So after preprocessing, your compiler sees the following sequence of declarations:
...
void some_func(my_structure *x);
...
typedef struct abcd {...} my_structure;
Bad juju. You either need a forward declaration of my_structure in main.h, or you need to break that circular dependency (which is the much preferred option). Is there anything in main.h that my_structure.h actually uses? If so, you will want to factor it out into a separate file that both main.h and my_structure.h include.