c++ - Declaring a global in a global header file? -
I have a header file, say, common. H, which is included on many projects in all files. Actually I want to declare a global variable, eg .:
When I do this, I get many linker errors
class memory manager * Gmail Manager is already defined.
: (?
As you type each of the variables in each compiled file These are then collision on linking. Remember that the preprocessor reads in all the header files and creates a large file from all of them, so every time this big file is compiled, You need to use the gMemoryManager has been made.
extern
and it is a non-header
extern DLL_EXPORT MemoryManager
One of your C ++ files
/ P>
DLL_EXPORT MemoryManager * GmailReader;
By the way I do not know what DLL_EXPORT does, I'm assuming that it needs to go to both places.
Comments
Post a Comment