Greg
Greg

Reputation: 34798

how do I specify the DEBUG definition in the project build settings?

I'm trying to implement the logging approach at http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ . I'm not sure how to complete the step:

Therefore the first line is a switch to see if we are in debug mode. I set this value in the build settings of my project. If you look under the “Preprocessor Macros” section you can set the DEBUG definition there.

This is to cater for a "#ifdef DEBUG" entry (I'm only giving first line) in your code.

QUESTION: How do I actually setup this DEBUG flag in the project setttings?

For example I've tried:

DLog(@"testingg");

Upvotes: 2

Views: 378

Answers (2)

benwong
benwong

Reputation: 2226

You'll find the answer in Turning on 'DEBUG' macro value.

Upvotes: 0

Stew
Stew

Reputation: 1921

If you are editing the build settings directly through the Xcode UI, the value is just DEBUG=1 (no -). It's just a space separated list of values if you have more than one.

I prefer to use xccongif files to manage my build settings, in which case you use the "Based On" drop down in the bottom right corner of the build settings to set which xcconfig file to use, and in the xcconfig file use the following setting (example shows setting a log level flag also):

GCC_PREPROCESSOR_DEFINITIONS = TTMAXLOGLEVEL=TTLOGLEVEL_INFO DEBUG=1

Upvotes: 1

Related Questions