10

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 Answer 1

24

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.

Sign up to request clarification or add additional context in comments.

6 Comments

this option was not available in my settings. I had to add OTHERC_FLAGS myself, as described in this article: de-co-de.blogspot.com/2009/01/xcode-31-other-c-flags.html now it works
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.
Is this answer still relevant now with the latest XCode 6 ?
@Mic Still relevant in XCode 8.
This is nuts for anyone coming to this from the Visual Studio.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.