Help! adding irrlicht engine in the C++ project (Linux)

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
angel80
Posts: 22
Joined: Mon Feb 07, 2005 1:37 pm
Location: Paris (France)

Help! adding irrlicht engine in the C++ project (Linux)

Post by angel80 »

Hi everybody,
I need some help about integrate Irrlicht in my C++ application running under Linux
I have just adding the engine in my scene class who manage all thing as: smgr, driver, camera, skybox, terrain etc...
with the code below:
I try all the functions in C (in one file like exemples) and it works but in C++ structure it doesn't

Code: Select all

// ***********************************************************************
// * include                                                             *
// ***********************************************************************
//Irrlicht
#include<irrlicht.h>
//DreamLand
#include<ECSS_MyEventReceiver.hpp>
//#include<ECSS_UserAction.hpp>
#include<ECSS_SetOfObject.hpp>
//Stl
#include <vector>

#pragma comment(lib, "Irrlicht.lib")

//Namespace
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


/*
extern IrrlichtDevice* 	device;		///< Pointer to the root object for doing everything with Irrlicht engine
extern IVideoDriver* 	driver;		///< Pointer to the video driver
extern ISceneManager* 	smgr;		///< Pointer to the scene manager
*/	
	
/**
* \brief This class manage all of DreamLand software scene components' : 
* Objects, Sounds, Display, Events, User
* 
* @author <a href="mailto:ftran01@etudiant.uni-mlv.fr">Franck</a>
* @author <a href="mailto:rloyet@etudiant.uni-mlv.fr">Raphaël LOYET</a>
* @author <a href="mailto:ldelatul@etudiant.uni-mlv.fr">Loïc DE LA TULLAYE</a>
*/
class ECSS_Scene 
{
private:
	//Attributs for Irrlicht engine
	IrrlichtDevice* 	device;		///< Pointer to the root object for doing everything with Irrlicht engine
	IVideoDriver* 		driver;		///< Pointer to the video driver
	ISceneManager* 		smgr;		///< Pointer to the scene manager
	stringw*		description;	///< Text in the top of the application
	//IGUIEnvironment* 	guienv;		///< Pointer to the graphical user interface environment
	
	//Attributs for global scene
	ECSS_MyEventReceiver* 	events;		///< Keyboard and mouse management object
	//ECSS_UserAction* 	user;		///< User action management object
	ECSS_SetOfObjects* 	SOObjects;	///< All of objects in the scene management vector
	int  		staticObjectNb;		///< Number of static objects
	int  		dynamicObjectNb;	///< Number of dynamic object
	
	//Attributs for the skybox
	ISceneNode* 	skyboxNode;		///< Pointer to the skybox object which manage the landscape of the scene
	bool 		skyboxOn;		///< Activate the skybox or not
	IImage*		skyboxImgFront;
	IImage*		skyboxImgBack;
	IImage*		skyboxImgTop;
	IImage*		skyboxImgBottom;
	IImage*		skyboxImgLeft;
	IImage*		skyboxImgRight;

.......


public :
	//Constructor & destructor
	/**
	* \brief Constructor of the Scene class
	*/
	ECSS_Scene(void);
	/**
	* \brief Destructor of the Scene class
	*/	
	~ECSS_Scene(void);
	
private:
	//Methods managing the scene globally
	/**
	* \brief This method allows to initialize the whole DreamLand scene with the xml config file :
	* components and objects
	*/
	void loadScene(void);

At the compilation state it makes lots of errors
I print some exemple there

Code: Select all

***** ECSS_Scene.o **** 
*In file included from ../../../include/IMeshBuffer.h:9, 
*from ../../../include/IMesh.h:9, 
*from ../../../include/IAnimatedMesh.h:9, 
*from ../../../include/irrlicht.h:39, 
*from ECSS_Scene.hpp:28, 
*from ECSS_Scene.cpp:22: 
*../../../include/SMaterial.h: In constructor `irr::video::SMaterial::SMaterial()': 
*../../../include/SMaterial.h:221: warning: `irr::video::SMaterial::<anonymous union>::<anonymous struct>::Texture2' will be initialized after 
*../../../include/SMaterial.h:190: warning: `irr::video::E_MATERIAL_TYPE irr::video::SMaterial::MaterialType' 
*../../../include/SMaterial.h:187: warning: when initialized here 
*../../../include/SMaterial.h:251: warning: `irr::video::SMaterial::<anonymous union>::<anonymous struct>::BackfaceCulling' will be initialized after 
*../../../include/SMaterial.h:238: warning: `bool irr::video::SMaterial::<anonymous union>::<anonymous struct>::GouraudShading' 
*../../../include/SMaterial.h:187: warning: when initialized here 
*../../../include/SMaterial.h:238: warning: `irr::video::SMaterial::<anonymous union>::<anonymous struct>::GouraudShading' will be initialized after 
*../../../include/SMaterial.h:210: warning: `f32 irr::video::SMaterial::Shininess' 
*../../../include/SMaterial.h:187: warning: when initialized here 
*In file included from ../../../include/IMeshBuffer.h:12, 
*from ../../../include/IMesh.h:9, 
*from ../../../include/IAnimatedMesh.h:9, 
*from ../../../include/irrlicht.h:39, 
*from ECSS_Scene.hpp:28, 
*from ECSS_Scene.cpp:22: 
*../../../include/S3DVertex.h: In constructor `irr::video::S3DVertexTangents::S3DVertexTangents(const irr::core::vector3df&, const irr::core::vector2df&, irr::video::SColor)': 
*../../../include/S3DVertex.h:131: warning: `irr::video::S3DVertexTangents::TCoords' will be initialized after 
*../../../include/S3DVertex.h:128: warning: `irr::video::SColor irr::video::S3DVertexTangents::Color' 
*../../../include/S3DVertex.h:119: warning: when initialized here

Is anyone knows how to integrate correctly the engine in my class???
Thank for your help
.: Franck :.
hybrid

Re: Help! adding irrlicht engine in the C++ project (Linux)

Post by hybrid »

angel80 wrote: At the compilation state it makes lots of errors
I print some exemple there

Code: Select all

***** ECSS_Scene.o **** 
*In file included from ../../../include/IMeshBuffer.h:9, 
*from ../../../include/IMesh.h:9, 
*from ../../../include/IAnimatedMesh.h:9, 
*from ../../../include/irrlicht.h:39, 
*from ECSS_Scene.hpp:28, 
*from ECSS_Scene.cpp:22: 
*../../../include/SMaterial.h: In constructor `irr::video::SMaterial::SMaterial()': 
*../../../include/SMaterial.h:221: warning: `irr::video::SMaterial::<anonymous union>::<anonymous struct>::Texture2' will be initialized after 
*../../../include/SMaterial.h:190: warning: `irr::video::E_MATERIAL_TYPE irr::video::SMaterial::MaterialType' 
*../../../include/SMaterial.h:187: warning: when initialized here 
*../../../include/SMaterial.h:251: warning: `irr::video::SMaterial::<anonymous union>::<anonymous struct>::BackfaceCulling' will be initialized after 
*../../../include/SMaterial.h:238: warning: `bool irr::video::SMaterial::<anonymous union>::<anonymous struct>::GouraudShading' 
*../../../include/SMaterial.h:187: warning: when initialized here 
*../../../include/SMaterial.h:238: warning: `irr::video::SMaterial::<anonymous union>::<anonymous struct>::GouraudShading' will be initialized after 
*../../../include/SMaterial.h:210: warning: `f32 irr::video::SMaterial::Shininess' 
*../../../include/SMaterial.h:187: warning: when initialized here 
*In file included from ../../../include/IMeshBuffer.h:12, 
*from ../../../include/IMesh.h:9, 
*from ../../../include/IAnimatedMesh.h:9, 
*from ../../../include/irrlicht.h:39, 
*from ECSS_Scene.hpp:28, 
*from ECSS_Scene.cpp:22: 
*../../../include/S3DVertex.h: In constructor `irr::video::S3DVertexTangents::S3DVertexTangents(const irr::core::vector3df&, const irr::core::vector2df&, irr::video::SColor)': 
*../../../include/S3DVertex.h:131: warning: `irr::video::S3DVertexTangents::TCoords' will be initialized after 
*../../../include/S3DVertex.h:128: warning: `irr::video::SColor irr::video::S3DVertexTangents::Color' 
*../../../include/S3DVertex.h:119: warning: when initialized here

Is anyone knows how to integrate correctly the engine in my class???
Thank for your help
I did not check your code yet, but these warnings are definitely no problem. They just tell that attributes of some Irrlicht classes were declared in different order than they were initialized in some constructor later on.
I already submitted a patch to Niko to fix this, but you may also choose to remove -Wall option from compiler options, or add -Wno-reorder to still get important warnings later on.
angel80
Posts: 22
Joined: Mon Feb 07, 2005 1:37 pm
Location: Paris (France)

Thank for your help

Post by angel80 »

Hi hybrid,
Your right, there aren't warnings now. thank for your help
.: Franck :.
Post Reply