However if I put the declaration of the enum in a header file and include it in main.c I get an error that helpfully informs me that it is a syntax error, but no further information. So the link to the error in the output takes me to the foot of the enum declaration in the header.

It is hard to tell, but you have to realise that there is no magic about header files, they are simply inserted into the translation unit by the pre-processor. To that extent any errors issues within a header file needs to be considered in the context of whatever precedes and follows the header, including all include and macro expansion and conditional compilation etc.

To avoid a number of problems, your header file should have include guards, and it must end in at least one blank line.

It is hard to tell, but you have to realise that there is no magic about header files, they are simply inserted into the translation unit by the pre-processor. To that extent any errors issues within a header file needs to be considered in the context of whatever precedes and follows the header, including all include and macro expansion and conditional compilation etc.

To avoid a number of problems, your header file should have include guards, and it must end in at least one blank line.