I have a class with a static variable of type QComboBox *. I have created a static member function from which i want to return this static variable. Here is the sample code:
Header code
{
---
---
---
public:
private:
};
Class TestPage : public QWidget
{
---
---
---
public:
static QComboBox *getTestCombo ();
private:
static QComboBox *sm_pTestCombo;
};
To copy to clipboard, switch view to plain text mode
CPP code
{
return sm_pTestCombo;
}
QComboBox * TestPage::getTestCombo ()
{
return sm_pTestCombo;
}
To copy to clipboard, switch view to plain text mode
I am getting the following linking error:
undefined reference to 'TestPage::sm_pTestCombo'
Any ideas?
Bookmarks