consider the snippet below:
#ifdef AAA && (defined BBB)
...
#endif
gcc-4.5.2 complains on this line:
extra tokens at the end of #ifdef directive.
Is it illegal to combine ifdef
and defined
?
Thanks!
The #ifdef
requires a single identifier and is equivalent to #if defined(identifier)
.
You need to use the #if
directive if you have a more complex expression:
#if (defined AAA) && (defined BBB) // true if AAA and BBB are both defined
#if AAA && (defined BBB) // true if AAA is true and BBB is defined
#ifdef
will only work on one token.
If you want to use more than one then write
#if defined(AAA) && defined(BBB)
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