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.
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.
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.
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.
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.
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.
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.
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.