How to add a 'or' condition in #ifdef

michael picture michael · Jun 8, 2010 · Viewed 113.4k times · Source

How can I add a 'or' condition in #ifdef ?

I have tried:

#ifdef CONDITION1 || CONDITION2

#endif

This does not work.

Answer

jalf picture jalf · Jun 8, 2010
#if defined(CONDITION1) || defined(CONDITION2)

should work. :)

#ifdef is a bit less typing, but doesn't work well with more complex conditions