Full Version: include header file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have included an header file (and two global variables) into vamosworld.h to control a virtual reality helmet.

using namespace std;

#include "font.h"
#include "ai.h"
#include "trackmap.h"

#include "isense.h"  // Virtual Reality Helmet
//Virtual Reality Helmet variable
I need to use these variables and some functions of the helmet into the files vamosworld.cpp and gui.cpp.
When i try to compile, the compiler don't tell me nothing but the linker give to me a lot of errors like:
"multiple definition of trackerHandle" or "multiple definition of trackerData" (the variables that i have defined).
"undefined references to ISD_OpenTracker" (a function of the helmet library).
Why if i have made the definitions into the #ifndef _VAMOSWORLD_H and vamosworld.h is included into vamosworld.cpp and gui.cpp ?
Down here there's a screenshot of a part of the errors:
Why not put your globals in a C file instead of the header? You can access your globals from other C files using the extern keyword.