compiler error that depends upon the location of a typedef...

It is expected behaviour of the IDE to include prototypes not specified by the user,
it is designed to be used by unexperienced persons.

Add your own prototypes and the you will see the need to have the typedef
(or at least a forward declaration of it) above that point.

Put the typedef in an include file.

What is your problem really?