Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Can I use PB Build Setting in an #if statement

Can I use PB Build Setting in an #if statement
Thread Tools
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Oct 21, 2003, 05:32 PM
 
I would like to have a specific Build Style in a Project Builder project which would build a product that has some logging to the console when run.

Can I have a Build Setting defined that determines whether the logging code gets compiled?

sort of like this:

Code:
#if _DEBUG_ NSLog(@"awakingFromNib"); #endif
I tried it but it didn't seem to work.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 21, 2003, 05:48 PM
 
EXTRA_CFLAGS=-D_DEBUG_
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Oct 21, 2003, 07:52 PM
 
Thanks for the reply.

I still can't quite get it working.

I did a test and #defined _TEST_ in the header and _DEBUG_ only through the Development build settings for my Target.

Then I added the following in my code:

Code:
#ifdef _DEBUG_ NSLog(@"tagText"); #endif #ifdef _TEST_ NSLog(@"_TEST_ is defined as a macro"); #endif
but only the second logging happens.

Am I missing something?
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Oct 22, 2003, 05:56 AM
 
ah - Success!

I posted my Q to the project builder list and it turns out that it's

OTHER_CFLAGS

instead of

EXTRA_CFLAGS
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:18 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2