4

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.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
Raphael
  • 291
  • 3
  • 10

1 Answers1

5

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.

Jens Ayton
  • 14,532
  • 3
  • 33
  • 47
  • 1
    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 02 '11 at 23:52
  • 1
    Highlight the bold field, and then press COMMAND+DELETE. It will whack that pesky override. – jww Nov 11 '12 at 01:27