Original Post
I''m creating a particle system. I have a CParticle class and a CParticleSystem class, and to make things fast I want CParticle''s Update method to be inline. However, I get this linker error when I compile:
ParticleSystem.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CParticle::Update(void)" (?Update@CParticle@@QAE_NXZ)
I had it working fine for a while, but I changed quite a bit of stuff, then I realized it was better before so I changed it back, and now I''m getting this error. Here is some code:
// This is CParticle
class CParticle
{
public:
CParticle();
virtual ~CParticle();
D3DXVECTOR3 m_vPos;
D3DXVECTOR3 m_vVel;
int m_iLife;
bool m_bExists;
void Create();
inline void Update();
};
// This is how Update() is defined
inline void CParticle::Update()
{
float fElapse = 1.0f / FRAMES;
m_vVel.x += 0.01f * (rand() % 11) - 0.05f;
m_vVel.y += 0.01f * (rand() % 11) - 0.05f;
m_vVel.z += 0.01f * (rand() % 11) - 0.05f;
m_vPos += fElapse * m_vVel;
m_iLife -= 1000 / FRAMES;
if(m_iLife <= 0)
m_bExists = false;
}
// This is the only place that calls CParticle::Update()
void CParticleSystem::Update()
{
CParticle* itParticle = m_aParticles;
CParticle* end = m_aParticles + m_iMaxCount;
for(; itParticle != end; itParticle++)
{
if(itParticle->m_bExists)
itParticle->Update();
}
}
I haven''t used inline functions very often so the problem could be something stupid, but I can''t think of anything I changed that would make it go from working to not working. Any ideas of what''s going on?