Add preprocessor macro to a target in xcode 6

66,760

Solution 1

I've done a screenshot to show where it is in Xcode, because it's easier :)

enter image description here

  1. Select project file
  2. Select the target you want
  3. Go to Build Settings
  4. Search for 'preprocessor'
  5. Add your preprocessor macro either for Debug, Release, or both.

Solution 2

In Xcode 9 you have to add a preprocessor macros to Project, not Target. Also don't forget to add "D" as the firs letter. For example, "DDebug", then it works.

Share:
66,760
user1051307
Author by

user1051307

Updated on July 09, 2022

Comments

  • user1051307
    user1051307 almost 2 years

    Probably this is pretty simple, but I can't find a way to define a preprocessor macro for a target in Xcode 6.

  • user1051307
    user1051307 over 9 years
    Thank you JoeFryer!!! ...you saved my day! I couldn't find it because I had the 'Basic' tab selected! ...stupid mistake of mine!
  • JoeFryer
    JoeFryer over 9 years
    @user1051307 don't forget to mark the answer as correct (if it is correct)
  • thst
    thst almost 9 years
    And if you happen to search your (insert important bodypart here) off for this setting make sure, the filter is set to ALL settings, not just BASIC... <facepalm>
  • John M
    John M almost 9 years
    If I want for both debug and release I enter it twice? No place to put shared ones? When looking at the situation before I edited, I saw $(inheritedxxx) -- can't remember the exact spelling. Seemed like there was some support for something a bit better than having to repeat myself. But couldn't figure it out.
  • JoeFryer
    JoeFryer almost 9 years
    $(inherited) means that the settings are inherited from the project level to the target level. This probably isn't what you want, so yes, in your case, you could add it twice.
  • Elise van Looij
    Elise van Looij over 8 years
    @JohnM, if you enter a value on a line without expanding it, the value is applied to all underlying options, i.e. debug and release. If you want the value to apply to one option, expand the option list and set the individual values.
  • Nick N
    Nick N over 4 years
    For a related swift migration use the following: stackoverflow.com/questions/38813906/…