views:

242

answers:

1

Hi!

I'm quite new to Xcode (and Mac in general). I started a little iPhone project - coding in C++ whatever possible - and just noted that my assert(); commands are executed also in release mode.

Is this a known problem and how do I solve it properly?

thanks!

+1  A: 

Xcode does not add -DNDEBUG for release mode automatically.

To add it, go to Project | Edit Project Settings. You need to be on the Build tab and choose Configuration Release. Add a new Preprocessing Macro of NDEBUG.

R Samuel Klatchko
this option was not available in my settings. I had to add OTHERC_FLAGS myself, as described in this article: http://de-co-de.blogspot.com/2009/01/xcode-31-other-c-flags.html now it works
genesys
You should be able to see Preprocessor Macros in Project > Edit Active Target > Build, but if you add it at the project level, then it will be propagated to all targets, which is probably what you want.
cdespinosa