high_flyer
17th September 2007, 22:02
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:
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
};
And in the implementation file (cpp) (in global scope):
FrmPower::BUS m_BorC = FrmPower::NONE;
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.
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:
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
};
And in the implementation file (cpp) (in global scope):
FrmPower::BUS m_BorC = FrmPower::NONE;
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.