I'm porting an iPhone game to Mac and I'm writing a file with common defines that has the following:
// first reset all defines
#undef TARGET_IPHONE
#undef TARGET_MAC
// set defines
#if TARGET_OS_MAC
#if TARGET_OS_IPHONE
#define TARGET_IPHONE
#else
#define TARGET_MAC
#endif
#endif
#ifdef TARGET_IPHONE
#error err1
#endif
#ifndef TARGET_IPHONE
#error err2
#endif
But when building for iPhone, both err1 and err2 are thrown by the compiler.
I don't get it, what's the problem there?
EDIT: After about an hour of trying things with no luck, I had to add my own define to xcode build options.
#and the directive itself (i.e.# if...) and thus achieve a reasonable simulation of normal indentation. – mu is too short Mar 6 '11 at 21:34