Hi! I have a class called GUI. It is separated into a header and a CPP. (Both named GUI)
I want to make an instance of GUI called normalInterface, construct it automatically, and use it globally. (everywhere in the program, across multiple files) The GUI class has an Update function, which is what I need to use
At the bottom of GUI.h, I have this:
|
extern GUI normalInterface
|
At the bottom of GUI.cpp, I have this:
|
GUI normalInterface("interface.png", "IS ALLOCATED");
|
However, when I try to do this elsewhere in the program:
It does not work! I know for a fact that this class/update function does work, because when I create another instance of GUI within a function, and use it in that same function, it works. So I can do it internally - within a function.
But how do I make this global??? Thanks!