Sorry if this question maybe asked before but I couldn't find a proper answer for it. I am trying to use my own class file inside another class which was already written by different people. The whole program is based on Omnet++. Before building everything seems to be alright but as soon as I build the program gives me an error of
undefined reference to `RatePrediction::RatePrediction(double, double, double)
I am trying to use RatePrediction in CentralEntity and this is what I've done:
In RatePrediction.cc :
#include "CentralEntity.h"
RatePrediction::RatePrediction(double gs,double gi, double dataRate):
gs(gs), gi_int(gi), reqDataRate(dataRate), result(0), error(0){
//some codes
}
In CentralEntity.h :
#include "RatePrediction.h"
class CentralEntity : public cAsyncModule
{
//friend classes ....
protected:
virtual void initialize();
}
In CentralEntity.cc:
#include "RatePrediction.h"
void CentralEntity::initialize()
{
RatePrediction RateObj(1.1e-13,1.2-13,1e4);
}
EDIT:
@hildensia Thanks for your comment. I actually did this and now it works. But I am not sure if it can be reliable and stable or not.
I edited the Makefile
manually and I added:
OBJS= RatePrediction.o
RatePrediction.o: RatePrediction.cc
$(CXX) -c $(COPTS) RatePrediction.cc