WizenedEE: It pays no attention to #ifs.
Are you saying the Arduino IDE (cpp) ignores all #if statements?
I doubt it as that would break many things, and it does NOT ignore the line if the arithmetic test evaluates TRUE #if 1==1
Interestingly, if I explicitly #include <Arduino.h>, or another #include (<SPI.h>), it seems to work.
Using other preprocessor commands like #define do not alter behavior
Perhaps the issue is that the Arduino preprocessing is mis-handling the #if if and only if
a) the arithmetic test evaluates to FALSE
b) no other C code appears before it
here I assumed #include files would have c code not just CPP items, although this may be incorrect. Creating a simple test.h file with #if and a variable definition and #including it did not change behavior of original code - it still fails when arithmetic test is FALSE but works if test is TRUE
There is obviously something strange going on here with how Arduino IDE does its pre-processing.
Kludging in a dummy variable definition is a work-around, but silly one.
If it is required, then it should be documented. --- which is kind of an embarrassing thing to document.