Hi,
I have the following case:
I have a static member variable (NOT const!), that should manage unique information shared by all class instances, and I would like to initialize that variable one time.
This is what I did:
Header:
{
Q_OBJECT
public:
typedef enum { NONE=0,A,B,C,D } BUS;
private:
static BUS m_BorC;
//rest of the class
};
class FrmPower : public QWidget
{
Q_OBJECT
public:
typedef enum { NONE=0,A,B,C,D } BUS;
private:
static BUS m_BorC;
//rest of the class
};
To copy to clipboard, switch view to plain text mode
And in the implementation file (cpp) (in global scope):
FrmPower::BUS m_BorC = FrmPower::NONE;
FrmPower::BUS m_BorC = FrmPower::NONE;
To copy to clipboard, switch view to plain text mode
But I get multiple definition linking error for 'm_BorC' which I don't get, since it is not visible outside the implementation of FrmPower.
Any idea how to resolve this?
Thanks in advance.
Bookmarks