The header is included a maximum of once per translation unit (.c/.cpp) file. If the header creates a global variable instead of declaring the existance of a global variable, then each translation unit will create another instance of that global variable and you get a nice little explosion at the final linking stage (see your log). Thus, multiple definitions.
#ifndef MAIN_H
#define MAIN_H
// Definition. makes KABOOM if more than one .c/.cpp file includes this header
int my_global_var;
#endif
vs
#ifndef MAIN_H
#define MAIN_H
// existance declaration. Definition done in **one** separate .cpp file.
extern int my_global_var;
#endif