I am using omnet++ that follows c++, I want to make one simple controller. I want to change the value of static members of the controller from another file. But when I compile the code it generates undefined references.
My code is written following, Kindly suggest to me what should I do, Thanks in advance.
//controlTest.h
namespace OPTxGsPON {
class controlTest:public cSimpleModule, public cListener
{
public:
static int bbb;
protected:
virtual void initialize();
};
}; //namespace
//controlTest.cc
#include "controlTest.h"
namespace OPTxGsPON {
void controlTest::initialize()
{
controlTest::bbb = 0;
}
}; //namespace
//User.h
#include "controlTest.h"
namespace OPTxGsPON {
class User :public cSimpleModule
{
protected:
virtual void initialize();
};
}; //namespace
//User.cc
#include "controlTest.h"
#include "User.h"
namespace OPTxGsPON {
void User::initialize()
{
controlTest::bbb=12;
}
}; //namespace
Error: ../out/gcc-release/src/User/User.o:User.cc:(.rdata$.refptr._ZN9OPTxGsPON11controlTest2bbE[.refptr._ZN9OPTxGsPON11controlTest2bbE]+0x0): undefined reference to `OPTxGsPON::controlTest::bbb'
Please guide me How will I fix it...