-3

I want to use or in a preprocessor #ifdef directive. I've tried using the || operator but it hasn't worked. How can I do this?

Serket
  • 3,785
  • 3
  • 14
  • 45

2 Answers2

4
#if defined(SOMETHIG1) || defined(SOMETHING2)
/* .... */
#endif
0___________
  • 60,014
  • 4
  • 34
  • 74
1

You can't.

#ifdef COND is short for #if defined(COND). It has no way to combine conditions.

But, you don't need to use #ifdef! If you write it out in full, you can make use of all the operators you need:

#if defined(COND1) || defined(COND2)
Asteroids With Wings
  • 17,071
  • 2
  • 21
  • 35