Conditional compilation fails

PaulS:

One trick is to put the code that confuses it into an include file; the preprocessor won't touch anything in an included file.

The preprocessor will to. The IDE won't. Different applications; different processes.

The best trick is to simply avoid the preprocessor altogether.

I think that you are confusing the C preprocessor and the IDE.

No. I'm referring to the Arduino IDE preprocessor, which is part of the IDE, NOT the C/C++ preprocessor, which is part of avr-gcc.

The C/C++ preprocessor doesn't come into play until after the Arduino IDE preprocessor has already munged things into the .cpp file in the temp build directory. By then, it has already wreaked it's havoc.

In case there is any possible ambiguity I've added "Arduinido IDE" before the word "preprocessor" in my earlier post if appropriate. I appreciate not everyone has a clear understanding of the order of events in the build process.