Hey all, I found some strange behaviour that I don't understand.

The following code works in the main.c file. However it crashes when placed in a header file at line: "} CPlayer;". Can someone explain why? Am I missing something?

Code:
typedef struct CPlayerStruct {
	char* someString;
	int someInt;
	void someFunction(struct CPlayerStruct* p);
} CPlayer;



I tried various combinations, but all crash with a compiler error.

Code:
typedef struct CPlayer {
	char* someString;
	int someInt;
	void someFunction(struct CPlayer* p); // CRASH
} CPlayer;

struct CPlayerStruct {
	char* someString;
	int someInt;
	void someFunction(struct CPlayerStruct* p);
}
typedef struct CPlayerStruct CPlayer; // CRASH


Thanks

Last edited by OCMvL; 12/26/15 22:30. Reason: Problem solved