Unhandled Exception on CreateDevice [SOLVED]

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
Avidan84
Posts: 5
Joined: Tue May 05, 2009 2:18 pm

Unhandled Exception on CreateDevice [SOLVED]

Post by Avidan84 »

Hey guys, im a newb at irrlicht and i am trying to start a whole new project, i am following the hell world tutorial, and it is all set up fine but when i try to run it, it will get to createDevice(); and when it calls that function i get a unhandled exception error.

Code: Select all

device =
	#ifdef _IRR_OSX_PLATFORM_
		// Mac OS X
		createDevice( video::EDT_OPENGL, dimension2d<s32>(PixelsHorizontal, PixelsVertical), 16, false, false, false, 0);
	#else
		// Windows
		irr::createDevice( irr::video::EDT_SOFTWARE, irr::core::dimension2d<irr::s32>(PixelsHorizontal, PixelsVertical), 16, false, false, false, 0);
	#endif
device is set up as a member variable earlier on, i am pretty sure i have everything set up, libs linked and dll included.
Any ideas?
Please i need help ASAP :(
Last edited by Avidan84 on Tue May 05, 2009 4:16 pm, edited 1 time in total.
OMG Halp!!!!
CuteAlien
Admin
Posts: 9720
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Unhandled Exception on CreateDevice

Post by CuteAlien »

Avidan84 wrote:i am following the hell world tutorial
Yeah, that's hell on earth ;-)
Avidan84 wrote: Any ideas?
Yes. Post more code. Obviously createDevice works for most people as no one could do anything otherwise with the engine. So the problem is most likely not in this line. And as we don't see the rest we will have a hard time helping you otherwise ...

Btw. does the hello world example which is in the examples folder work?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Avidan84
Posts: 5
Joined: Tue May 05, 2009 2:18 pm

Post by Avidan84 »

Yes i can compile from the examples

Code: Select all

#ifndef IRRLICHT_SETUP_H
#define IRRLICHT_SETUP_H

#include "../Includes/CPPIncludes.h"
#include "../Includes/IrrlichtEngine.h"

namespace Castor
{
	class IrrlichtSetup
	{
	public:
		IrrlichtSetup();
		~IrrlichtSetup();

		// Sets up the initial Irrlicht engine
		int		SetupDevice(int PixelsHorizontal, int PixelsVertical);
		void	SetWindowTitle(std::string windowTitle);


	private:
		irr::IrrlichtDevice *device;
	};
}

#endif

//CPP FILE HERE

#include "IrrlichtSetup.h"

int Castor::IrrlichtSetup::SetupDevice(int PixelsHorizontal, int PixelsVertical)
{
	device =
	#ifdef _IRR_OSX_PLATFORM_
		// Mac OS X
		createDevice( video::EDT_OPENGL, dimension2d<s32>(PixelsHorizontal, PixelsVertical), 16, false, false, false, 0);
	#else
		// Windows
		irr::createDevice( irr::video::EDT_SOFTWARE, irr::core::dimension2d<irr::s32>(PixelsHorizontal, PixelsVertical), 16, false, false, false, 0);
	#endif

	if (!device)
		{return 1;}
	else
		{return 0;}
}


[/code]
OMG Halp!!!!
Avidan84
Posts: 5
Joined: Tue May 05, 2009 2:18 pm

Post by Avidan84 »

Code: Select all

#include "Includes/IrrlichtEngine.h"
#include "IrrlichtSetup/IrrlichtSetup.h"
#include "Includes/CPPIncludes.h"

int main( )
{
	int screenWidth = 1024;
	int screenHeight = 768;

	Castor::IrrlichtSetup *setup = new Castor::IrrlichtSetup();

	int result = setup->SetupDevice(screenWidth, screenHeight);



	return 0;
}


and in IrrlichtEngine  is

#ifndef IRRLICHT_ENGINE_H
#define IRRLICHT_ENGINE_H

#include <irrlicht.h>

#ifdef _IRR_WINDOWS_
	#pragma comment(lib, "Irrlicht.lib")
	#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
#endif

OMG Halp!!!!
CuteAlien
Admin
Posts: 9720
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, that looks ok. You say you can compile the example, but your code also does compile, you have a crash at runtime, right?

Maybe you accidentally mix Irrlicht versions? Like some old dll which is still in the systems folder?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Avidan84
Posts: 5
Joined: Tue May 05, 2009 2:18 pm

Post by Avidan84 »

Yeah it was a dll problem, solved now.
Thank you very much and i look forward to using this engine.
OMG Halp!!!!
Post Reply