So far I was using classes inheriting from other classes, now I had the need to creating a class inheriting from anything. I called it from my client class and I'm getting error that doesn't make sense to me. what am I doing wrong?
public:
float addPerc(float whole, float perc);
float subPerc(float whole, float perc);
float addPerc(float whole, float perc)
{
return 0;
}
float subPerc(float whole, float perc)
{
return 0;
}
calling from client
MathHelp* mathHelp = new MathHelp();
float mathResult = mathHelp->addPerc(100,5);
error LNK2019: unresolved external symbol "public: float __thiscall MathHelp::addPerc(float,float)" (?addPerc@MathHelp@@QAEMMM@Z)
referenced in function "public: virtual void __thiscall EnergyManager::draw(class cocos2d::Renderer *,class cocos2d::Mat4 const &,unsigned int)" (?draw@EnergyManager@@UAEXPAVRenderer@cocos2d@@ABVMat4@3@I@Z)
Method declarations need to also have the name of the class when you're declaring them outside of the class definition.
float MathHelp::addPerc(float whole, float perc)
{
return 0;
}
float MathHelp::subPerc(float whole, float perc)
{
return 0;
}