Tutorial "Hello world!" crashes

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
Brotkrumen
Posts: 6
Joined: Sat Jun 16, 2012 8:50 pm

Tutorial "Hello world!" crashes

Post by Brotkrumen »

Hey!

I have tried to set up Irrlicht. I am on a Win7 x64 machine and am using eclipse indigo cdt + mingw.

I tried following this set up tutorial: http://irrlicht.sourceforge.net/forum/v ... hp?t=25355 and then compile the hello world tutorial: http://irrlicht.sourceforge.net/docu/example001.html]the tutorial.
It does compile, no error messages, dll is in the folder of the exe etc, but when it hits

Code: Select all

device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
an empty window pops up and crashes.
The pre-compiled tutorial.exe works, so it shouldn't be a driver problem.

Is that a known bug? Am I missing something? Any help would be appreciated.

Thank you!
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Tutorial "Hello world!" crashes

Post by randomMesh »

Run the program from the command line and have a look at the debugging output. I guess it can't find your media due to wrong paths.
"Whoops..."
Brotkrumen
Posts: 6
Joined: Sat Jun 16, 2012 8:50 pm

Re: Tutorial "Hello world!" crashes

Post by Brotkrumen »

All it gives me is the build version of irrlicht and my operating system. then it crashes. I reproduced it with the same configuration on my xp machine so it is not win7 specific.

Guess the error is somewhere between keyboard and chair, so I'll just do what any decent human would do: Delete everything and start from scratch. Maybe even try code::blocks instead
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Tutorial "Hello world!" crashes

Post by CuteAlien »

Set a breakpoint in the first line in main to see if it reaches that. And if it does then just step through and see where it crashes. Debuggers are there to make your life easier :-)

(In case you are not familiar with the debugger - learn that first - it's simple and worth it. In an IDE it's usually as simple as clicking on a line and telling the IDE to set a breakpoint. That's already enough to make it stop at that line when it runs into it. And then you have some command to go to the next line which is called stepping and that way you can just go through your application line by line).
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
Brotkrumen
Posts: 6
Joined: Sat Jun 16, 2012 8:50 pm

Re: Tutorial "Hello world!" crashes

Post by Brotkrumen »

The debugger gets to:

Code: Select all

device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
There, trying to step further won't work and all I can do is stop the program.

Same program compiled in code::blocks runs fine. I guess I failed to set up eclipse correctly.

Thanks for your help, btw.
Bl00drav3n
Posts: 48
Joined: Sun Apr 22, 2012 11:55 pm
Location: Vienna
Contact:

Re: Tutorial "Hello world!" crashes

Post by Bl00drav3n »

Check if device is NULL.
Brotkrumen
Posts: 6
Joined: Sat Jun 16, 2012 8:50 pm

Re: Tutorial "Hello world!" crashes

Post by Brotkrumen »

The code is:

Code: Select all

        IrrlichtDevice *device =
                createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
                        false, false, false, 0);
 
        if (!device)
                return 1;
So if the device was 0, it wouldn't pass this part, right?

I tried example 2 now and here at

Code: Select all

video::IVideoDriver* driver = device->getVideoDriver();
the debugger gives me Segmentation fault with the message "No source available for "irr::CIrrDeviceStub::getVideoDriver() at 0x634c743e" "
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Tutorial "Hello world!" crashes

Post by CuteAlien »

How about the console log? Any warnings/errors there? (Maybe start from the command-line if your IDE doesn't show console output, I have no experience with Eclipse so I don't know how that is handled there).
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
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Tutorial "Hello world!" crashes

Post by zerochen »

he already checked this. i think you linked the wrong lib and used a different dll. are you sure that you used the 64bit dll?
Brotkrumen
Posts: 6
Joined: Sat Jun 16, 2012 8:50 pm

Re: Tutorial "Hello world!" crashes

Post by Brotkrumen »

Thank's everyone for the suggestions.

@zerochen
There is one irrlicht.dll in the irrlicht\bin\win32-gcc folder. This is the one i am using. Should there be a 64bit version of that one around? I thought you only need a 64bit .dll if you use a 64bit compiler. Anyways, I tried the same setup on an 32-bit xp machine with the same results.
I do have the 32bit versions of mingw, eclipse and java (required for eclipse) so it should all go smoothlike.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Tutorial "Hello world!" crashes

Post by CuteAlien »

Yeah, you need 64-bit environment for 64-bit versions (and I suspect they would be written into Win32-gcc as well and don't have yet an own target as all settings are identical anyway).

It all sounds a lot like a version mixup but as I never used Eclipse with Irrlicht I can't really help much I fear.
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
Brotkrumen
Posts: 6
Joined: Sat Jun 16, 2012 8:50 pm

Re: Tutorial "Hello world!" crashes

Post by Brotkrumen »

The irrlicht.dll is used at runtime, right? the pre-compiled hello world.exe works...

Thanks anyway. Its working on codeblocks so all is well.
I'll try to set it up on my xp machine again. Maybe I made a different mistake there...
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Tutorial "Hello world!" crashes

Post by Virion »

I think the precompiled hello_world.exe and irrlicht.dll are both 32bit. 64bit machine can run 32bit exe which is why you have no problem running it. however, the exe that you compiled is 64bit, but somehow the irrlicht.dll is 32bit which does not compatible with your exe. must compile your own irrlicht.dll (64bit) in order to run it correctly.
Post Reply