Custom SceneNodeAnimator don't want to work -.-

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Custom SceneNodeAnimator don't want to work -.-

Post by cookie »

Hiho, I've got a problem with my custom animator... I'm from the german Irrlicht board but the people there don't want to help me :D so I come to you and hope you will be better :O and sorry for my bad englisch ;)

So...I wrote my own animator class, so far so good but when I write something for the class into my *.cpp file I get this Debug-Message:
obj\Debug\Engine_Particle.o||In function `_ZN3irr4core12irrAllocatorIcE15internal_deleteEPv':|
\include\IAttributeExchangingObject.h:(.text+0x7b)||undefined reference to `vtable for CSceneNodeEmitterStop'|
\Engine_Particle.o||In function `_ZN21CSceneNodeEmitterStopC1EPN3irr5scene24IParticleSystemSceneNodeEi':|
\Engine_Particle.cpp|4|undefined reference to `VTT for CSceneNodeEmitterStop'|
\Engine_Particle.cpp|4|undefined reference to `vtable for CSceneNodeEmitterStop'|
\Engine_Particle.cpp|4|undefined reference to `vtable for CSceneNodeEmitterStop'|
\Engine_Particle.cpp|4|undefined reference to `vtable for CSceneNodeEmitterStop'|
||=== Build finished: 5 errors, 0 warnings ===|
I don't have any idea what I should do...

And here is the Sourcecode of my Animator-class

Header Filei:

Code: Select all

#ifndef ENGINE_PARTICLE_H_INCLUDED
#define ENGINE_PARTICLE_H_INCLUDED

#include <irrlicht.h>
#include "Engine_Globals.h"





using namespace irr;

class CSceneNodeEmitterStop : public ISceneNodeAnimator
{
	public:

		//! constructor
		CSceneNodeEmitterStop(int ms);

		//! destructor
		//virtual ~CSceneNodeEmitterStop();

		//! animates a scene node
		virtual void animateNode(ISceneNode* node, u32 timeMs);

		//! Writes attributes of the scene node animator.
		virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;

		//! Reads attributes of the scene node animator.
		virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);

		//! Returns type of the scene node animator
		virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_UNKNOWN; }

		//! Creates a clone of this animator.
		/** Please note that you will have to drop
		(IReferenceCounted::drop()) the returned pointer after calling
		this. */
		virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);

	private:
              int ms;
};

#endif // ENGINE_PARTICLE_H_INCLUDED
CPP File:

Code: Select all

#include "Engine_Particle.h"

CSceneNodeEmitterStop::CSceneNodeEmitterStop(int ms)
 {
 }

Without this lines in the CPP File the program starts correctly, but with this lines I get this damn Error which I wrote at the top of my super-sweet-english-skilled post ;)

I hope you can help me, thx.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to implement all pure virtual methods. You only provided some method declarations and a constructor, that's not enough.
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Post by cookie »

uh...could you explain me what you mean? I didn't understand this.

Thanks
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to give the actual implementations (the function bodies) of the previously only as "=0" defined methods from the abstract interfaces. Please read a book about abstract classes and (pure) virtual methods, and other nice features of OOP and C++. This is definitely a must to get into touch with Irrlicht.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

You have functions which are declared but have no code.
In your CPP file you must implement all of the functions which you have declared in your H file. Currently you have only implemented the constructor.

Fill the other stub functions in your CPP file, like so:

Code: Select all

void CSceneNodeEmitterStop::animateNode(ISceneNode* node, u32 timeMs)
{

}
edit: Hybrid beat me to it :)

Read through this quick tutorial up to the polymorphism section, it will help a lot:
http://www.cplusplus.com/doc/tutorial/classes/
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Post by cookie »

AAAH thank you now it works!
Ok and now I'll learn something about OOP ;)

cya
Post Reply