I want to make a variable that can be accessed by all classes that I have made. How do I do this? I have tried by stating in the mainwindow header file:
public:
extern int number;
And then referencing to this in other classes by saying:
MainWindow::number;
This gives me an error: error: storage class specified for ‘number’. Can anybody say what I´m doing wrong?
Keyword to success is
static. Make it a static variable.