Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-08-2008, 08:17 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 107
Warp is on a distinguished road
Default How do I define preprocessor macros in the xcode project settings?

I'm trying to define a preprocessor macro in the project settings (so that I can write #ifdef MACRO_NAME lines in my code). I can't figure out how to do that.

No, there is no "Preprocessor Macros" nor "Preprocessor Macros Not Used In Precompiled Headers" in the project settings.

No, there is no "Other C flags" in the project settings.

No, adding a new user-defined setting in the "User-Defined" group has no effect.
Warp is offline   Reply With Quote
Old 01-03-2009, 12:28 AM   #2 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 19
rssmsvc is on a distinguished road
Default

Same thing here, I read every tutorial where it says is should be in Build Settings and I don't see it.
rssmsvc is offline   Reply With Quote
Old 01-03-2009, 12:49 AM   #3 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
RickMaddy will become famous soon enough
Default

I see this problem too but there seems to be one condition that allows you to see all of these options. In the drop down list in the upper left corner of your Xcode project window, drop down the list and pick the "Active SDK" entry that says "(Project Setting)" next to it.

Now go to the Project menu and select "Edit Project Settings". Now under the "Build" tab you should see several "GCC 4.0" sections that don't seem appear unless you pick the right SDK.

Go to the section labeled "GCC 4.0 - Language". There is a setting named "Other C Flags". Add all the "-Dwhatever" macros you want there.

This drove me nuts until I figured out that picking the right Active SDK make these appear.

Last edited by RickMaddy; 01-03-2009 at 02:11 AM. Reason: Fixed typo
RickMaddy is offline   Reply With Quote
Old 01-03-2009, 01:04 AM   #4 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 19
rssmsvc is on a distinguished road
Default

Quote:
Originally Posted by RickMaddy View Post
I see this problem too but there seems to be one condition that allows you to see all of these options. In the drop down list in the upper left corner of your Xcode project window, drop down the list and pick the "Active SDK" entry that says "(Project Default)" next to it.

Now go to the Project menu and select "Edit Project Settings". Now under the "Build" tab you should see several "GCC 4.0" sections that don't seem appear unless you pick the right SDK.

Go to the section labeled "GCC 4.0 - Language". There is a setting named "Other C Flags". Add all the "-Dwhatever" macros you want there.

This drove me nuts until I figured out that picking the right Active SDK make these appear.
First, you are FREAKIN AWESOME to take the time to answer this, but mine was slightly different.

I am using XCode 3.1.2 and I needed to select "(Project Settings)Debug" not Project Default and then from the Menu, doesn't show from the direct dialog.

That is just silly,
rssmsvc is offline   Reply With Quote
Old 01-03-2009, 02:10 AM   #5 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
RickMaddy will become famous soon enough
Default

Glad it worked. Yep, I made a typo. Mine is "Project Setting" too.
RickMaddy is offline   Reply With Quote
Old 01-03-2009, 02:16 AM   #6 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 19
rssmsvc is on a distinguished road
Default

I tried adding my own macros, and it kept complaining. -DDEBUG will trigger
#ifdef DEBUG but does anyone know if there is a way to create a custom define per configuration.
rssmsvc is offline   Reply With Quote
Old 01-03-2009, 02:31 AM   #7 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 19
rssmsvc is on a distinguished road
Default

Just a followup, I found that if you exit and then restart XCode after the default is set like above all the hidden properties show up and you can set it.

Again, insanely weird.
rssmsvc is offline   Reply With Quote
Old 01-03-2009, 10:16 AM   #8 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 1,431
PhoneyDeveloper is on a distinguished road
Default

Rick, I had noticed that a bunch of my GCC settings had somehow become user settings (e.g., warnings). This was in a project built before 3.1.2.

It appears that if the Base SDK and the Active SDK match vis-a-vis the Device/Simulator then it works as expected but if they're different then the GCC settings all become user-defined. The version number doesn't seem to matter.

I think this is new with 3.1.2 and is a bug or misfeature of some kind.
PhoneyDeveloper is offline   Reply With Quote
Old 01-03-2009, 10:21 AM   #9 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 19
rssmsvc is on a distinguished road
Default

Quote:
Originally Posted by PhoneyDeveloper View Post
Rick, I had noticed that a bunch of my GCC settings had somehow become user settings (e.g., warnings). This was in a project built before 3.1.2.

It appears that if the Base SDK and the Active SDK match vis-a-vis the Device/Simulator then it works as expected but if they're different then the GCC settings all become user-defined. The version number doesn't seem to matter.

I think this is new with 3.1.2 and is a bug or misfeature of some kind.
To add to that, if you get them to match add a value and then go to a different
version or if you an find the Build Alias you can add it to user defined.

Get the Apple Xcode Build command document for all the features.
rssmsvc is offline   Reply With Quote
Old 04-10-2010, 11:53 PM   #10 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 1
BeastCoder is on a distinguished road
Default

Quote:
Originally Posted by RickMaddy View Post
I see this problem too but there seems to be one condition that allows you to see all of these options. In the drop down list in the upper left corner of your Xcode project window, drop down the list and pick the "Active SDK" entry that says "(Project Setting)" next to it.

Now go to the Project menu and select "Edit Project Settings". Now under the "Build" tab you should see several "GCC 4.0" sections that don't seem appear unless you pick the right SDK.

Go to the section labeled "GCC 4.0 - Language". There is a setting named "Other C Flags". Add all the "-Dwhatever" macros you want there.

This drove me nuts until I figured out that picking the right Active SDK make these appear.
THANK YOU for this answer. I couldn't, for the life of me, find any of these GCC settings. It baffles me why you can't set preprocessor macros in ANY SDK! Thanks again.

BeastCoder is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting 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



» Advertisements
» Online Users: 361
10 members and 351 guests
Absentia, akphyo, apatsufas, BinHex, fredidf, iGamesDev, Kirkout, MarkC, mottdog, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:25 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0