Posted on 2003-03-31
I have a set of C++ files and am having problems with global variables. The main function is in dct.cpp, which uses two function implementation files dct_lib.cpp and cif_lib.cpp with header files dct_lib.h and cif_lib.h. I wish to define a global int array 'basis'. The idea is at the start of the main function to call a function in one of the libraries to initialise it. Then most of the subsequent processing needs to read these values but will never alter them. I currently pass references to a local variable between functions. I dont use an OOP design methodology so no classes and inheritance. Where should a global variable be defined in this case? I tried defining it in dct.cpp but the library implementation files cant see it...