tags:

views:

791

answers:

1

Hi, Can you please tell me how can I set a global #define in my Xcode project? I don't want to put #define DEBUG in every .h of my project.

Thank you

+4  A: 

This is generally done in the Xcode project properties. Right-click on the project itself in the project window (the project is the top level of the heirarchy) and choose "get info". This will bring up the project inspector window. In the inspector window, choose the "Build Settings" tab. Now, use the search field to find an entry called "preprocessor macros", and put the string DEBUG into that entry.

If you do this only for the "Debug" build configuration (there should be a drop-down menu within the project inspector window), then this DEBUG macro will only be #defined when you are actually debugging.

See Apple's documentation for all the dirty details.

e.James