The most convenient place to declare global variables is, of course, in a header file that is included in every file where the global variable is evaluated or assigned.
Note that you must not include an initial value where extern
is used. An initial value forces the C++ compiler to allocate memory for
the variable, thus establishing the variable's definition, which can be
done only once.