Conditional compilation, how to determine whether a variable has been declared?
Normally you use the "#ifdef" directive.

The opposite is "#ifndef".

For example, if you only wanted to include variable definitions once many use this pattern for a header file named, say, "my_variables.h":

#ifndef MY_VARIABLES_H
#def MY_VARIABLES_H

int counter;
bool flag;

#endif


In this way, no matter how many times you include this file, you only define the variables once.  Because after the 1st time the compiler sees this file, the variable MY_VARIABLES_H is defined and the subsequent time the compiler sees this file, the compiler will skip over the variable defines.