Take the 2-minute tour ×

When I add a Preprocessor Macro in XCode 4 to one of my targets, it is used and conditional compilation occurs as I expect it to.

However, if I move that setting to the project level and out of one of my targets the preprocessor macro apparently is ignored and not used at all.

I verified that the macro is defined at all if I put it in the project's build setting through logging that is only compiled in when that macro is enabled.

How can that be?

System: OS X Lion, XCode 4.1 build 4B110, building for iOS 4.3.5, using the LLVM compiler, not GCC.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Have you completely deleted the build setting at the target level (not just blanked it)? If not, the target setting will completely override the project one. (You can avoid this by using $(inherited) in the target-level build setting.)

Xcode 4 makes it easy to see this type of problem: in the target’s Build Settings view, select “Levels” (instead of “Combined”) in the filter bar.

share|improve this answer
Yes, you were right. Apparently, my real mistake was to ignore the bold fonts in the target that mark that there is an empty setting that overrides everything I set on the project level. –  Raphael Sep 2 '11 at 23:52
Highlight the bold field, and then press COMMAND+DELETE. It will whack that pesky override. –  jww Nov 11 '12 at 1:27

Your Answer


