iDevGames Forums
#define DEBUG, RELEASE - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: #define DEBUG, RELEASE (/thread-1840.html)



#define DEBUG, RELEASE - haudio - Jan 27, 2009 09:30 AM

Are there any global #defines like there are in win32 for the different build targets?

I'm looking for the equivalent of #define _DEBUG

Thank you in advance


#define DEBUG, RELEASE - ThemsAllTook - Jan 27, 2009 10:33 AM

I'm not sure if Xcode automatically defines any, but if it doesn't, you could easily add -DDEBUG to OTHER_CFLAGS in your debug target.


#define DEBUG, RELEASE - haudio - Jan 28, 2009 09:29 AM

Yes this is exactly what I want, however I can't find it. I screwed around with some user-defined group which didn't work.

Any additional help? Screen grabs, steps, anything?

Thanks


#define DEBUG, RELEASE - arekkusu - Jan 28, 2009 12:50 PM

Try this:

1) launch Xcode. Before you do anything, make it suck less by going to Preferences and using the All-In-One layout.
2) New Project, using whichever template you want, like Mac OS X Cocoa Application.
3) click the Build tab, and then the third tiny icon at the lower left of the build panel ("show build transcript", if you hover over it to see the tooltip.) This will show you what Xcode is actually doing. It's just a GUI on top of gcc, and you want to see the flags sent to gcc.
4) Cmd-B to build. With the default Debug configuration, you'll see something like
Code:
CompileC build/foo.build/Debug/foo.build/Objects-normal/i386/main.o /Users/...
    /Developer/usr/bin/gcc-4.0 -x objective-c -arch i386 ... -Wunused-variable -isysroot ...
5) double-click the project icon at the top of the Groups & Files pane on the left.
6) go the the Build tab. Here's where you can change or add compiler flags. There are a lot of them. The "Research Assistant" button at the bottom of this panel will show you the real gcc name for each item, and a description of what it does.
7) the "Configuration" popup at the top of this panel lets you change settings differently for Debug/Release. Choose Debug.
8) In the "GCC 4.0 Preprocessor" section, edit "Preprocessor Macros" and add "DEBUG". Xcode will automatically add -D for you.
9) Cmd-B again. You'll see something like
Code:
CompileC build/foo.build/Debug/foo.build/Objects-normal/i386/main.o /Users/...
    /Developer/usr/bin/gcc-4.0 -x objective-c -arch i386 ... -Wunused-variable [b]-DDEBUG[/b] -isysroot ...



#define DEBUG, RELEASE - haudio - Jan 29, 2009 01:35 AM

arekkusu, you sir are a god.

Thank you so much!


#define DEBUG, RELEASE - kalimba - Jan 29, 2009 02:47 PM

Hmmm... I can't seem to locate a "GCC 4.0 Preprocessor" section in my project. Any idea what would cause it to NOT be there?

There is a section near the bottom, labeled "User-Defined", that has a few GCC-looking definitions, though.

The only other setting I can find that refers to GCC is in the "Compiler Version" section, where the "C/C++ Compiler Version" setting is set to "GCC 4.0".


#define DEBUG, RELEASE - arekkusu - Jan 29, 2009 03:58 PM

My description was written using Xcode 3.1.2 from the iPhone 2.2 SDK. Earlier versions of Xcode may be slightly different.

The search field in the Build configuration panel will let you find a preprocessor setting, wherever it might be. "Other C Flags" is also OK for adding arbitrary defines.


#define DEBUG, RELEASE - kalimba - Jan 29, 2009 05:20 PM

arekkusu Wrote:My description was written using Xcode 3.1.2 from the iPhone 2.2 SDK. Earlier versions of Xcode may be slightly different.

The search field in the Build configuration panel will let you find a preprocessor setting, wherever it might be. "Other C Flags" is also OK for adding arbitrary defines.

I'm running Xcode 3.1.2 with the 2.2 SDK (haven't installed 2.2.1 yet). I was checking in an iPhone project, GLSprite to be exact and couldn't find those settings. When I created a new Mac OSX project, those settings were there. So I tried creating a brand new iPhone project (view controller based) and the setting aren't there.

I'm wondering what rhyme or reason there is for these particular settings being available or not. Anyone have any ideas?


#define DEBUG, RELEASE - kalimba - Feb 5, 2009 12:50 AM

kalimba Wrote:I'm wondering what rhyme or reason there is for these particular settings being available or not. Anyone have any ideas?

Well, I think I figured out what's going on. If I switch my project's "Active SDK" to any Simulator configuration and check the Build settings in the Project Info, I get none of the GCC 4.0 options. If I switch the project's Actve SDK to a device configuration, the CGG 4.0 options are suddenly available.

What's up with that? Huh