call multiple #ifdefs

i've just learnt about the #define and #ifdef thing, and am using it to allow 4 versions of my sketch to be compiled, depending on if i want it to have debugging on or off, how much debugging goes on, and to send the data to the serial monitor, lcd or both and so on.

At the moment i have multiple #ifdef 's that have the same code in them, because they set up things like output buffers, which are only used when either of the debug #ifdef 's are called and not needed when running the sketch normally, i.e.:

#define full_debug
#define minimal_debug
~~~ later on in the sketch
#ifdef full_debug
do thisĀ 
do that
do the other
#endif

#ifdef minimal_debug
do this
do that
do the other
#endif

i wanted to do something like

#ifdef full_debug AND minimal_debug
do this
do that
do the other
#end both ifs

But it won't let me.. tried && and things like that, but it seems to be one #ifdef identifier at once.

is it possible to have a single piece of code that can be used by 2 #define 's?

The syntax would be:

#if defined(full_debug) && defined(minimal_debug)

#endif

But, I'm scratching my head trying to come up with a scenario where "full_debug" and "minimal_debug" would both be defined at the same time.

ahh sorry, bad choice of words there,

in the actual sketch it's things like
#define debug
#define loopTimer
#define serialOut

and so on,

i tried the '#if defined(full_debug) && defined(minimal_debug)' thing, but when compiling it says the item i was trying to define is not found, so it's not recognised the multiple #if defined calls,

most likely something i'm doing wrong, so i'll keep playin with it

Figured it out, i needed to use the || (or) operator instead of && (and) for come calls.

so it's working now, thankyou

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.