43

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

1

2 Answers 2

102

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.
7
  • 3
    Thank you JoeFryer!!! ...you saved my day! I couldn't find it because I had the 'Basic' tab selected! ...stupid mistake of mine! Nov 14, 2014 at 11:57
  • @user1051307 don't forget to mark the answer as correct (if it is correct)
    – JoeFryer
    Nov 14, 2014 at 15:44
  • 4
    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>
    – thst
    Jul 20, 2015 at 16:04
  • 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.
    – John M
    Jul 27, 2015 at 16:55
  • 1
    For a related swift migration use the following: stackoverflow.com/questions/38813906/…
    – Nick N
    Jan 12, 2020 at 3:43
5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.