Here's how I deal with global variables. I have one header file, I call Globals.h, with these definitions :
#ifdef DEFINE_GLOBALS
#define Global
#define GlobalVar(Type,Variable,Value) Type Variable=Value
#else
#define Global extern
#define GlobalVar(Type,Variable,Value) extern Type Variable
#endif
Then, in one and ONLY one file do this :
#define DEFINE_GLOBALS
#include "include "Globals.h"
#endif
before I include headers that define variables. Here are some sample definitions :
typedef FILE * PFILE;
GlobalVar( PFILE, PtrLogFile, NULL );
GlobalVar( size_t, LineCount, 0 );