Hello World error

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
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

Hello World error

Post by Galhad »

Hi, i tried to make Irrlicht's Hello World application. It compiles without any errors, but when i run program it close automaticly. I run debugger and it show error:Your program reported an access violation (segmentation error). I use Dev-c++ and here is the code:

Code: Select all

#include <irrlicht.h>
 using namespace irr;

 int main()
 {
        // start up the engine
        IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D8,
                core::dimension2d<u32>(640,480));

        video::IVideoDriver* driver = device->getVideoDriver();
        scene::ISceneManager* scenemgr = device->getSceneManager();

        device->setWindowCaption(L"Hello World!");


        // add a first person shooter style user controlled camera
        scenemgr->addCameraSceneNodeFPS();

        // draw everything
        while(device->run() && driver)
        {
                driver->beginScene(true, true, video::SColor(255,0,0,255));
                scenemgr->drawAll();
                driver->endScene();
        }

        // delete device
        device->drop();
        return 0;
 }
Please help.
randomMesh
Posts: 1187
Joined: Fri Dec 29, 2006 12:04 am

Re: Hello World error

Post by randomMesh »

I can't see any problems with the code.
Maybe you used the wrong DLL (the one for MSVC rather than gcc).

I suggest to get another IDE anyway, since Dev C++ is not supported anymore because it is ancient. Better get Code Blocks or Eclipse.
"Whoops..."
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

Post by Galhad »

How can I see what DLL i used? I compiled first example and it works. i copied code to my project, compile it and i've got this same error. I add ibIrrlicht.a.
randomMesh
Posts: 1187
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

You should use the one in bin/Win32-gcc/.
"Whoops..."
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

Post by Galhad »

Now I downloaded Code Block. And still have this same problem. Example works, but this code in other project not. Can you explain how use this DLL?
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

You just put the dll to the same folder as exe
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
randomMesh
Posts: 1187
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

Galhad wrote:Can you explain how use this DLL?
If you run your executable from the examples directory (bin/Win32-VisualStudio/), it would use the DLL inside, which is the one for MSVC. And because you used libIrrlicht.a, which is for gcc, this can not work.

Easiest way is to make a new folder, copy your executable and the DLL from bin/Win32-gcc/ to it and that's it. Just make sure you don't have a wrong Irrlicht DLL in windows/system32 or something.
"Whoops..."
Galhad
Posts: 13
Joined: Sat Mar 20, 2010 6:20 pm
Location: Zielona Gora, Poland

Post by Galhad »

I copy my executable, 01.HelloWorld (example) and dll. And it doesnt work. My executable and example. Earlier i compiled that example and in Win32-gcc folder it run normally.
EDIT I change build folder to Win32-gcc, compiled new project with this same code and now its works :D Thanks :D
Post Reply