ISceneUserDataSerializer is a struct? (apparently)

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
Paradigm^
Posts: 6
Joined: Tue Oct 17, 2006 2:53 pm

ISceneUserDataSerializer is a struct? (apparently)

Post by Paradigm^ »

Hello (again).

I found I had exactly the same problem as mentioned in this thread and with a bit of searching and clarifying I now know what I should be doing. Having come to compile time, I get a very odd error though:

Code: Select all

In file included from engine.cpp:3:
mapserialiser.h:9: error: invalid use of undefined type `struct irr::scene::ISceneUserDataSerializer'
../irrlicht-1.1/include/ISceneManager.h:111: error: forward declaration of `struct irr::scene::ISceneUserDataSerializer'
As far as the documentation, the source code, and I know, ISceneUserDataSerializer is definitely not a struct. It's an interface. All I've tried to do is implement this, but it's not happy, and I don't know why. Here's my .h file:

Code: Select all

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

class MapSerialiser : public ISceneUserDataSerializer{
public:
	MapSerialiser(ISceneManager*, IMetaTriangleSelector*, IMetaTriangleSelector*);
	virtual IAttributes* createUserData(ISceneNode*);
	virtual void OnReadUserData(ISceneNode*, IAttributes*);

private:
	ISceneManager* sm;
	IMetaTriangleSelector* mp;
	IMetaTriangleSelector* mpp;
};
Is something wrong with it, or is the problem elsewhere? Thought I'd put this question here rather than in the other thread because I have a feeling it's a programming error rather than something serious.

Cheers!
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

It looks like you need to include ISceneUserDataSerializer.h. Your header shows no includes, but at the very least it should have the following near the top...

Code: Select all

#include <Irrlicht.h>

// need to include this explicitly because someone forgot to put it in the global header Irrlicht.h
#include <ISceneUserDataSerializer.h>
Paradigm^
Posts: 6
Joined: Tue Oct 17, 2006 2:53 pm

Post by Paradigm^ »

Aha! Thanks. All my #includes are in the .cpp files, which is why you don't see them in the .h file. Adding a #include for ISceneUserDataSerializer fixed it. Well done to whoever it is that forgot to add it in irrlicht.h, it's had me confused for the past two hours :p

Cheers!
Post Reply