First question here.
I have some troubles with the XCode Build System, specifically with preprocessor definitions.
I’m trying to define a macro that is used as part of a header file to conditionnaly select which code to compile. The usual way to go would be to use
#define CONFIG and then include the header on the next line. Once the header gets included, the macro is already defined and the header is configured accordingly.
But that’s where it starts to get weird!
The macro is not recognized at all and the header gets included as if the
#define statement was not there so it fails to
#define CONFIG 1 and it gets defined as 0 in
#define CONFIG 1
// From there:
// - Build System: CONFIG is always 0, except if defined in build settings
// - Clang (only): CONFIG is 1
#define CONFIG 0
The build system acts as expected when the preprocessor macro is defined in the project build settings under the "Apple Clang – Preprocessing" section. It defines the global macro using the
-D parameter of
clang making it available to any files used by the project.
However, source code compiles correctly when I use clang from a terminal using
Could someone tell me what I need to configure for the build system to behave normally?
Source: Ios Questions