Society of Robots - Robot Forum

Software => Software => Topic started by: Admin on October 15, 2009, 04:32:27 PM

Title: conditional ifdef, how to do OR statement?
Post by: Admin on October 15, 2009, 04:32:27 PM
I can't figure out how to do an OR statement using ifdef.

My best guess:
Code: [Select]
     #ifdef MACRO1 || MACRO2
     
     controlled text
     
     #endif

but it doesn't work . . .
../file.h:156:18: warning: extra tokens at end of #ifdef directive

Anyone know?
Title: Re: conditional ifdef, how to do OR statement?
Post by: supernoob on October 15, 2009, 05:01:25 PM
Try
Code: [Select]
#if defined(TEST_1) || defined(TEST_2)
// do stuff
#endif
Title: Re: conditional ifdef, how to do OR statement?
Post by: Admin on October 20, 2009, 12:28:56 PM
It works! Thanks!