hi, im having a nightmare trying to share a class between 2 files, ive searched this site and google and nothing seems to work.
scenario:
the class is extremely simple (2 member functions, constructor, destructor, 2 variables (both bool))
the class works fine when i declare it within a C++ file and use it there, however i want to also modify the variables (via the functions) from a different C++ file.
i tried declaring the class globaly from the first file (it showed up in my globals folder for the project) but the second file said it was undeclared. (also tried the other way, same problem)
ive tried using extern keyword in stdafx.h (as was suggested on experts-exchange) and just declaring the class once but that errored (LNK2005 [something about the symbol being defined elsewhere]).
i dont want to resort to global variables, but at the moment thats the only way i can get it working.
appreciate any help, my brains fried at the moment.
If somethings hard to do, its not worth doing - Homer Simpson
scenario:
the class is extremely simple (2 member functions, constructor, destructor, 2 variables (both bool))
the class works fine when i declare it within a C++ file and use it there, however i want to also modify the variables (via the functions) from a different C++ file.
i tried declaring the class globaly from the first file (it showed up in my globals folder for the project) but the second file said it was undeclared. (also tried the other way, same problem)
ive tried using extern keyword in stdafx.h (as was suggested on experts-exchange) and just declaring the class once but that errored (LNK2005 [something about the symbol being defined elsewhere]).
i dont want to resort to global variables, but at the moment thats the only way i can get it working.
appreciate any help, my brains fried at the moment.
If somethings hard to do, its not worth doing - Homer Simpson