hi, this should be an easy one, i just havent dealt much with global variables.
i have an unmanaged c++ project set up with many different classes. Each class has its own .h and .cpp set up correctly. They're included in a standard library that each cpp references. All of this works.
There is a main cpp file which also references the standard library. all of its functions are global, and can be accessed from any other class or file. Should its variables, declared outside of functions then also be global, and available from any class? They're not. Other classes can't find these variables. When added to the standard library, they get an error because they are created about 20 different times (once per .cpp file that includes the library) despite the "#pragma once" that i have.
I need these variables to be available everywhere. Am i just missing some syntax? or would a namespace be my solution. I'd like to avoid the latter if at all possible.
thanks in advance.