Do not put variable definition in header files! Header files are only for declarations not for definitions! Put definitions globally in .c source files and use extern keyword to reference those global variables. The header guards (
#ifdef
and #endif
) only prevent inclusion of the same source file, not for avoiding multiple definitions for the same variable!