我无法弄清楚我的错误在哪里。我收到消息:
Error 21 error LNK2019: unresolved external symbol "public: __thiscall ParticleAnchoredSpring::ParticleAnchoredSpring(class Vector3 *,float,float)" (??0ParticleAnchoredSpring@@QAE@PAVVector3@@MM@Z) referenced in function "public: void __thiscall MyGameWorld::Initialize(void)" (?Initialize@MyGameWorld@@QAEXXZ) C:\Users\Foo Nuts\Dropbox\GSP321_DavidJohnson\GSP321_Johnson_HM2\iLab2\MyGameWorld.obj
函数声明:
ParticleForceRegistry registry;
ParticleAnchoredSpring spring(&Vector3(10, 3, 10), 10, 10);
registry.add(WMI->getListPtr()[0], &spring);
类定义:
class ParticleAnchoredSpring : public ParticleForceGenerator
{
protected:
Vector3 *anchor;
real springConstant, restLength;
public:
ParticleAnchoredSpring(Vector3 *anchor, real springConstant, real restLength);
virtual void updateForce(Particle *particle, real time);
};
构造函数声明:
void ParticleAnchoredSpring::updateForce(Particle *particle, real time)
{
Vector3 force;
particle->getPosition();
force -= *anchor;
real magnitude = force.magnitude();
magnitude = (restLength - magnitude) * springConstant ;
magnitude *= springConstant;
force.normalize();
force *= -magnitude;
particle->addForce(force);
}