Archived

This topic is now archived and is closed to further replies.

Boogsie

How to inline member functions?

Recommended Posts

Hi First off, I am using Visual Studio .NET. I am trying to inline member functions of a class. When I add the inline keyword to either the prototype in the class definition or the function itself, the program compiles, but the linker complains that the function is missing, and lists the place where the function is being called from. Particles error LNK2019: unresolved external symbol "public: void __thiscall CParticleEngine::AddParticle(unsigned long,class CParticle *)" (?AddParticle@CParticleEngine@@QAEXKPAVCParticle@@@Z) referenced in function "public: bool __thiscall CParticleEmitter::Update(float)" (?Update@CParticleEmitter@@QAE_NM@Z) Can anyone help me? Thanks

Share this post


Link to post
Share on other sites
Inline member functions must be either inline, or be defined in the header file.


  
class foo
{
void bar()
{
// do some stuff...

}
void baz();
};

inline void foo::baz()
{
// do some other stuff...

}




Update GameDev.net system time campaign: 'date ddmmHHMMYYYY'

[edited by - dalleboy on January 20, 2003 5:03:49 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Putting member functions in the class declaration (bar in dalleboy''s example) guarantees inlining. Using the inline keyword (baz) does not guarantee inlining.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Putting member functions in the class declaration (bar in dalleboy''s example) guarantees inlining. Using the inline keyword (baz) does not guarantee inlining.

got a source to back this up?

Share this post


Link to post
Share on other sites