Can't create Irrlicht Renderer

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

rtr_18
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Mon Aug 25, 2008 10:02

Can't create Irrlicht Renderer

Postby rtr_18 » Wed Jun 16, 2010 13:56

Hi!
I've compiled CEGUI with Irrlicht Engine. My first project shows the following error.


main.cpp(18) : error C2664: 'CEGUI::IrrlichtRenderer::IrrlichtRenderer(irr::IrrlichtDevice &)' : cannot convert parameter 1 from 'irr::IrrlichtDevice *' to 'irr::IrrlichtDevice &'

Code: Select all

#include "irrlicht.h"
#include "CEGUI.h"
#include "CEGUIIrrlichtRenderer.h"
#include "CEGUIWindowManager.h"

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

int main ()
{
 IrrlichtDevice* device = createDevice(EDT_SOFTWARE, core::dimension2d<u32>(800, 600), 16, false);
 //IrrlichtDevice& dev = device;
 CEGUI::IrrlichtRenderer& myRenderer = new IrrlichtRenderer(device);
 CEGUI::System::create(myRenderer);
 IVideoDriver* driver = device->getVideoDriver();
 driver->beginScene(true, true, SColor(255, 255, 0, 0));
 ISceneManager* smgr = device->getSceneManager();
 WindowManager* wmgr = WindowManager::getSingletonPtr();
 Window* myRoot = wmgr->createWindow(CEGUI::String("Default Window"), CEGUI::String("root"));
 System::getSingleton().setGUISheet(myRoot);
 while(device->run() && driver)
 {
  if(device->isWindowActive())
  {
  smgr->drawAll();
  CEGUI::System::getSingleton().renderGUI();
  driver->endScene();
  }
 }
 device->drop();
 return 0;
}


irr::createDevice() returns only a pointer. But CEGUI::IrrlichtRenderer() expects a reference. What to do to resolve this error?

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Can't create Irrlicht Renderer

Postby Jamarr » Wed Jun 16, 2010 17:23

rtr_18 wrote:main.cpp(18) : error C2664: 'CEGUI::IrrlichtRenderer::IrrlichtRenderer(irr::IrrlichtDevice &)' : cannot convert parameter 1 from 'irr::IrrlichtDevice *' to 'irr::IrrlichtDevice &'

irr::createDevice() returns only a pointer. But CEGUI::IrrlichtRenderer() expects a reference. What to do to resolve this error?


This is not CEGUI issue, so I am not sure why you are asking it here. Simply googling "C2664" would have given you the answer. Take some time to research an issue yourself before asking others to do it for you. Anyway, you can find a more in-depth answer here: http://www.cplusplus.com/doc/tutorial/pointers/
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: Can't create Irrlicht Renderer

Postby agamemnus » Thu Jun 17, 2010 04:01

Try this instead:

extern IrrlichtDevice *device;

...

CEGUI::IrrlichtRenderer &CEGUIRenderer = CEGUI::IrrlichtRenderer::bootstrapSystem (*device);


Return to “Help”

Who is online

Users browsing this forum: No registered users and 24 guests