#defines in the middle of code

There is a bug, at least in 0017 (and not documented as fixed) in how the pre-processor scans the code for pre-process directives. It apparently stopped looking when the first executable statement was encountered.

I have them in the middle of the code because they are to be used together with a class defined there.

Why isn't the class defined in a separate file?