I am declaring a global variable in a .h file like this:
extern MyClass object;
Then I include the .h file in other files and try to use object. I get
"object not declared", but then when I add:
MyClass object;
to the file I am including the .h file in, I get "multiple definitions
of object". How can I fix this?
Thanks,
Colin
int myGlobal = 1;
and in myFile.h you would have:
extern int myGlobal;
now all files that include myFile.h will have access to the global
variable myGlobal.
Joseph.