Xcode seems to "build" for the editor warnings and errors with a configuration, which differs from the current scheme and thus does not pick up the preprocessor macros, which I define in xcconfig files.
I use a Standard.xcconfig files in which I define a preprocessor macro like this:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) X_MY_FLAG=1
I added new configurations "Debug Standard" and "Release Standard" in which I select the Standard configuration for the project (or the target).
I added a new scheme, which uses the "... Standard" variants of the configurations and select it in that dropdown in the top line of Xcode.
In main.m I use this snippet to test for the macro:
#if X_MY_FLAG == 1
#warning "Success. X_MY_FLAG picked up."
#else
#error "X_MY_FLAG not picked up"
#endif
Running a build (Cmd-B) produces a nice build output and as expected the warning message appears, not the error. However, in the editor window I also get the error information shown. (See screenshot below.) Seeing both cases of the #if getting evaluated is not what I want to see here.
So for the editor Xcode runs a "build", which does not use the configuration specified in the selected scheme. Does anybody have a hint, how to fix this or what the actual underlying problem is?


