Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode - defining a preprocessor macro for conditional compilation

I'm using XCode 4, and in my project build settings, I've set :

Preprocessor macros
   Debug   DEBUG;FULL
   Release FULL

and in another target of the same project :

Preprocessor macros
   Debug   DEBUG;LITE
   Release LITE

The two targets are using exactly the same files, except the plist info file that is made distinct.

Then later in my code, I wrote :

#ifdef FULL
    // ###### FULL VERSION
    NSLog(@"test");
    // ###### 
#endif

But the log is never written.

What am I doing wrong ? I don't want (need) to set a value to the FULL statement.

like image 603
Oliver Avatar asked Apr 05 '11 19:04

Oliver


1 Answers

Multiple preprocessor macros are separated by spaces not semicolon. So it should be:

Preprocessor macros
   Debug   DEBUG FULL
   Release FULL

With the semicolon, you're defining a single macro called "DEBUG;FULL". And that won't match your #ifdef.

like image 189
Codo Avatar answered Oct 01 '22 02:10

Codo