IrrlichtDevice causes crash

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
alex4
Posts: 1
Joined: Wed Feb 28, 2018 5:41 pm

IrrlichtDevice causes crash

Post by alex4 »

I am trying to create a very simple Hello World type program, but I am coming into a problem.
The code for my program is as follows:

Code: Select all

#include <irrlicht.h>
#include <iostream>
 
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
 
/*
 * Code entry point - runs the game
 */
int main() {
    IrrlichtDevice *device =
        createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16, false, false, false, 0);
    
    if (!device)
        return 1;
    device->setWindowCaption(L"Hello World!");
    
    std::cout << "TEST" << std::endl;
    device->getVideoDriver();
    std::cout << "ANOTHER TEST" << std::endl;
    while (true) {
        //infinite loop for testing purposes
    }
When this code runs, TEST is printed to the console, but not ANOTHER TEST, and it crashes. It also produces game.exe.stackdump:

Code: Select all

Exception: STATUS_ACCESS_VIOLATION at eip=004012A1
eax=0000000C ebx=0065CC2C ecx=0065CB60 edx=00000000 esi=200717D5 edi=200717CD
ebp=0065CC08 esp=0065CBC4 program=C:\Users\Alex\Documents\ProgrammingStuff\cpp\Game\dist\Debug\Cygwin-Windows\game.exe, pid 12764, thread main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args
0065CC08  004012A1 (00000001, 0065CC2C, 200280F0, 610079C2)
0065CD18  61007A27 (00000000, 0065CD74, 61006A20, 0000000E)
End of stack trace
 
Also, if I remove the line:

Code: Select all

device->getVideoDriver();
a blank, unresponsive window appears (as expected), but the title is not Hello World, and instead is a series of question marks, 'U's and 'S's.
I am writing my code in NetBeans and using the 32bit Cygwin compiler with the 32bit Irrlicht libraries, although I am doing this on a 64bit pc (but I don't believe this should be causing the problem??).
How can I go about resolving this issue?

Thank you in advance
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: IrrlichtDevice causes crash

Post by CuteAlien »

Sorry for later answer, as you probably noticed our provider was down last days.
Anyway - this is not a problem in the code, but likely something about dll. Unfortunately cygwin isn't really supported. It might be possible to get it working by recompiling Irrlicht yourself, but I do not have much experience with it.
If you want to avoid using MS tools like VisualStudio then I'd reommend working with MinGW instead (also usually needs to recompile DLL, but that's a solution known to work and one I also test once in a while).
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
Post Reply