2012-08-01 38 views
0

我無法揣摩出我的錯誤是 我得到的消息:錯誤錯誤LNK2019:無法解析的外部符號「公用:__thiscall

Error 21 error LNK2019: unresolved external symbol "public: __thiscall ParticleAnchoredSpring::ParticleAnchoredSpring(class Vector3 *,float,float)" ([email protected]@[email protected]@@[email protected]) referenced in function "public: void __thiscall MyGameWorld::Initialize(void)" ([email protected]@@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); 
}; 

構造函數dec laration:

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); 
} 
+2

窗戶框上的用戶名是迷人的。 – paddy 2012-08-01 04:26:09

回答

0

您尚未實施構造函數。你只是宣佈它。添加:

ParticleAnchoredSpring::ParticleAnchoredSpring(Vector3 *_anchor, real _springConstant, real _restLength) 
: anchor(_anchor), springConstant(_springConstant), restLength(_restLength) 
{ 
} 

到您的實施文件。

我假設real定義爲float

相關問題