In xcode, while compiling apps with gcc, I want to throw compilation time errors if things like NSZombieEnabled is on for a distribution release, thus ensuring that compilation will fail and I won’t accidentally do something stupid.
I did some googling, but could not figure out how to cause the compiler to bail if a certain condition is met. Surely it must be easy, am I just not finding it?
Use the
#errordirective:Since
NSZombieEnabledis an environment variable, you’ll need to do something clever in your build script to define your macro as zero or one.Strictly speaking, the
#errordirective occurs in the C Preprocessor, notgcc. But that shouldn’t matter in the case you’ve described.