In a pre-compiled header if I do:
#define DS_BUILD
#define PGE_BUILD
#define DEMO
then in source I do:
#if (DS_BUILD && DEMO)
---- code---
#elif (PGE_BUILD && DEMO)
--- code---
#else
--- code ---
#endif
Do I get an error that states:
error: operator '&&' has no right operand
I have never seen this before. I am using XCode 3.2, GCC 4.2 on OS X 10.6.3
You need to add the defined keyword since you want to check that you defined have been defined.
#if defined (DS_BUILD) && defined (DEMO)
---- code---
#elif defined (PGE_BUILD) && defined (DEMO)
--- code---
#else
--- code ---
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With