Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
include header file
07-20-2007, 05:16 AM,
include header file
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:
07-20-2007, 11:37 PM,
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.

Forum Jump:

Users browsing this thread: 1 Guest(s)