I just created a new cocoa project on Xcode 4.3.3. The preprocessor macros for the Apple LLVM compiler 3.1 settings have a DEBUG=1 $(inherited) value assigned. I removed it and add it again, and now I’m getting an error when compiling :
clang: error: no such file or directory: ‘DEBUG=1’
I search for the value on the project settings and I saw that the value is also defined in “Other warning flags”
My questions are:
- What is the difference between just having
DEBUGvsDEBUG=1? - What does
$(inherited)do? - What is it also doing on the other warning flags?
First, if you’re getting a compilation error, then you most likely put the macro back in the incorrect place in the project settings. Please ensure you’ve put it into the
Debugconfiguration branch of thePreprocessor Macrositem under theApple LLVM compiler x.x - Preprocessingsection.For your other questions:
DEBUGso it’s essentially empty. You can test for whether it exists or does not exist, but not much. The second sets it to1so that the preprocessor can actually do comparisons like#if DEBUG && SHOULD_DIE_ON_ERRORwhere you might abort if the application comes across some validation error, but only ifSHOULD_DIE_ON_ERRORis set and1and you’re running in debug mode.$(inherited)just brings in other macros you’re inheriting from further up the chain. So if your project defines some items and your target defines some more, the target gets the project’s settings as well without having to re-define them.