You should declare variables in .h files but initialize them in .cpp file.
Otherwise you include header 2 times and then it is initialize 2 times.
Note: do not forget to use #pragma once or via definition avoid doublbe declaration.
#pragma once
extern int g_variable;
int g_variable = 0;
Maxim.