Easiest way to add global variables inside a C++ program is use extern.
First add this in the header file:
extern string globalVar;
Then add the the same variable inside the cpp file you are using but u need to remove the extern.
string globalVar;
In this way your able to pass around the variable in program context
Leave a Reply