I want do define a variable in the header and be able to use it in multiple files.
e.g. have variable a
defined somewhere and be able to use/change it in both
In the header file, write this:
extern int a;
extern float b;
This will declare the variables.
In one of the CPP files, write this:
int a = 1;
float b = 2.2;
This will define the variables. It does not matter in which CPP file you put the definitions, as long as the variables are defined exactly once.