Getting Irrlicht to work with Dev-C++

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.
Sleddog
Posts: 7
Joined: Sun Aug 31, 2008 4:26 pm

Getting Irrlicht to work with Dev-C++

Post by Sleddog »

Hello, I am trying to get Irrlicht to work with Dev-C++. I have successfully added the include files to the include folder in C:/Dev-Cpp/include/. However I cannot find where to put the file Irrlicht.dll. I have placed it in essentially every folder I could think of within Dev-Cpp/ but none worked. Is this even the right file? Do I need a .a file?

Other info:
Using Windows 7 Home
My code successfully compiles until I call device = createDevice(...
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Getting Irrlicht to work with Dev-C++

Post by Virion »

Sleddog wrote:Hello, I am trying to get Irrlicht to work with Dev-C++. I have successfully added the include files to the include folder in C:/Dev-Cpp/include/. However I cannot find where to put the file Irrlicht.dll. I have placed it in essentially every folder I could think of within Dev-Cpp/ but none worked. Is this even the right file? Do I need a .a file?

Other info:
Using Windows 7 Home
My code successfully compiles until I call device = createDevice(...
.dll should be put together with your program .exe
.a is the one which should be linked to the compiler
Sleddog
Posts: 7
Joined: Sun Aug 31, 2008 4:26 pm

Re: Getting Irrlicht to work with Dev-C++

Post by Sleddog »

Virion wrote:.dll should be put together with your program .exe
.a is the one which should be linked to the compiler
Good to know, but it did not fix my problem. I put the .dll in the folder with my .exe, as well as the .a in Dev-Cpp/lib (and combinations of those), but it didn't help. Any other suggestions?
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

nono i didn't mean that you should put the .a into the same folder as your exe

link it with linker settings of your compiler
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Please post the exact error - just copy & paste this. Do this always when you get an error instead of trying to describe it. You seem to mix something up - dll's are not even needed in compiling - they are only needed at runtime. Maybe you get a linker error? That would be the missing link-library (the .a) which has to be in your linker-path (you can add folders to the linker-path in your IDE - usually called "linker directories" or something similar).

Also we usually recommend switching to code::blocks (also called C::B) as the Dev-C++ development seems to have stopped a few years ago and so we don't really support it anymore.
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
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

k... Heres the code:
// HelloUniverse.cpp
// Include the Irrlicht header
#include "irrlicht.h"

// Irrlicht Namespaces
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


int main()
{
IrrlichtDevice *irrDevice = createDevice(EDT_SOFTWARE,
dimension2d<s32>(512, 384),
16,false,false,
0);

irrDevice->setWindowCaption(L"Dev-C++ and the Irrlicht Engine!");

IVideoDriver* irrDriver = irrDevice->getVideoDriver();
ISceneManager* irrSceneMgr = irrDevice->getSceneManager();
IGUIEnvironment* irrGUIEnv = irrDevice->getGUIEnvironment();

irrGUIEnv->addStaticText( L"Hello World! This is the Irrlicht software engine!",
rect<int>(10,10,200,30), true, true, 0, -1);

while(irrDevice->run())
{
irrDriver->beginScene(true, true, SColor(0,192,192,192));

irrSceneMgr->drawAll();
irrGUIEnv->drawAll();

irrDriver->endScene();
}

irrDevice->drop();

return(0);
}

and here's the error messages:

Compiler Default compiler
Building Makefile: "C:\Dev-Cpp\Irrdemo\Makefile.win"
Executing make clean
rm -f ello.o Irrdemo.exe
g++.exe -c ello.cpp -o ello.o -|"C/Program Files/Irrlict-1.6/include"
ello.cpp ln function 'int main()":
ello.cpp 19: error: invalid initialization of reference of type 'const irr::core::dimension2d<irr::u32>&' from expression of type 'irr::core::dimension2d<irr::s32>'
C:/Program Files/Irrlicht-1.6/include/irrlicht.h:329: error: in passing argument 2 of 'irr::lrrlichtDevice* irr::creatDevice(irr::video::E_DRIVER_TYPE, const irr::core::dimensions2d<irr::u32>&, irr::u32, bool, bool, bool, irr::lEventReceiver*)'
make.exe: ***[ello.o] Error 1
execution terminated

I have my linkers linking but I'm missing something that's just out of my paripheral vision.

Tim
code happens
knapshots
Posts: 3
Joined: Thu Dec 31, 2009 6:44 am

Post by knapshots »

Heres how it worked for me
note that i use wxdevc++ which is more or less the same

=> Step 1: U need Irrlicht.dll compiled with dx support which isnt the case w.r.t the gcc distribution. Get it from

http://www.gprogs.com/irrlicht.mod/IrrDX_v1_6.zip

=> Step 2: Copy that file ie(Irrlicht.dll) and the other dll file( ie D3DX81ab.dll) to the system32 folder on ur comp.
( If u arent able to find it just go to start->run-> type "system32")

=> Step 3: Include the irrlicht include folder into the C & C++ includes of ur Directories tab which can be accessed from Tools=>Compiler Options=>Directories
in my case i extracted irrlicht 1.6 to my devcpp folder itself
so it is as follows
Image


=> Step 4: After extracting the zip file ie (Irr DX_v1_6.zip) to a folder, copy the file libIrrlicht.a to a directory preferably ur project directory
and add it to the linker as follows
Project=>Project Options=>Parameters=> Add Library or object
and select that file ie libIrrlicht.a
In my case i extracted it to the folder win32-gcc
so it is as follows
Image


=> Step 5: Well thats about it. Make sure the path to the stuff u use from ur drive ie the media files etc etc is given correctly
And now you are good to go
try this prog out i used EDT_DIRECT3D9 just to show that it works
u can use EDT_OPENGL or others

Code: Select all


#include <irrlicht.h>

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

int main()
{
	
	IrrlichtDevice *irrDevice =
		createDevice( video::EDT_DIRECT3D9, dimension2d<u32>(640, 480), 16,
			false, false, false, 0);

	if (!irrDevice)
		return 1;

  irrDevice->setWindowCaption(L"Dev-C++ and the Irrlicht Engine!");
    
    IVideoDriver* irrDriver = irrDevice->getVideoDriver();
    ISceneManager* irrSceneMgr = irrDevice->getSceneManager();
    IGUIEnvironment* irrGUIEnv = irrDevice->getGUIEnvironment();

    irrGUIEnv->addStaticText(
            L"Hello World! This is the Irrlicht engine!",
	        rect<int>(10,10,200,30), true, true, 0, -1);
    
    while(irrDevice->run())
    { 
        irrDriver->beginScene(true, true, SColor(0,192,192,192));
                
                irrSceneMgr->drawAll();
                irrGUIEnv->drawAll();
                
	    irrDriver->endScene();
	}
 
    irrDevice->drop();

    return(0);
}

BTW, dont forget to add it to the project mate :))
Thats about it. Hope it helped
Cheerio,
knapshots
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

Sorry for the long delay, the wife kidnaped me for a long weekend and I was tottaly without my internet addiction.

I downloaded the IrrDX_v1_6.zip and put the D3DX81a.dll in the system32 file where I previously dropped the Irrlicht.dll file.

I recompiled as is and came up with the same errors. Since the .dll's should't kick in untill after the compilation and into the run cycle I determined it isnt the .dll's...
I compared next my linkers to the linkers you have listed in the includes...

I dont have the OpenCV program... what is it and where can I get it ??

Thanks
Tim
code happens
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Code: Select all

ello.cpp 19: error: invalid initialization of reference of type 'const irr::core::dimension2d<irr::u32>&' from expression of type 'irr::core::dimension2d<irr::s32>'
C:/Program Files/Irrlicht-1.6/include/irrlicht.h:329: error: in passing argument 2 of 'irr::lrrlichtDevice* irr::creatDevice(irr::video::E_DRIVER_TYPE, const irr::core::dimensions2d<irr::u32>&, irr::u32, bool, bool, bool, irr::lEventReceiver*)' 
That means "Can't create a dimension2d of unsigned integers from a dimension2d made of signed integers"

Change this line:

Code: Select all

    IrrlichtDevice *irrDevice = createDevice(EDT_SOFTWARE,
                                          dimension2d<s32>(512, 384),
                                          16,false,false,
                                          0);
to:

Code: Select all

    IrrlichtDevice *irrDevice = createDevice(EDT_SOFTWARE,
                                          dimension2d<u32>(512, 384),
                                          16,false,false,
                                          0);
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

Thanks Bitplane, that took care of that error but now I have a linker error.
In projct options / Parameters / Linkers I have the files:
../../Program Files/irrlicht-1.6/lib/Win32-gcc/libIrrlicht.a
../lib/libjpeg.a
../lib/libz.a
as directed by preivious suggestions tutorials.

And they apprently are not being recocognised (or not found) according to the new error msg:
Executing Make...
Make.exe -f "C:\Dev-CPP\Irrdemo\makefile.win" all
g++.exe ello.o -o "Irrdemo.exe" -L "C:/Program Files/Irrlicht-1.6/lib" ../../Program Files/irrlicht-1.6/lib/Win32-gcc/libIrrlicht.a ../lib/libjpeg.a ../lib/libz.a
g++.exe: ../../Program. No such file or directory
g++.exe: Files/Irrlicht-1.6/lib/Win32-gcc/libIrrlicht.a No such file or directory
Make.exe: ***[Irrdemo.exe] Error 1
Execution terminated

I confirmed the locations of the files but they are not linking correctly... What the filibuster am I still doing wrong ???

Tim
code happens
Mircea Popescu
Posts: 26
Joined: Sat Jan 02, 2010 12:48 pm

Post by Mircea Popescu »

If make says they're not in there, they're not in there. Put either the path to the .a in correctly, or else put the .a in the path you currently use.
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

Never Mind...

I cleared out the linker files and re- added them to the project and it ran correctly. woot!!!

I pickd up Borland C++ way back in college and it never seemed to want to work with any other code... I got rid of it finnally last lear cuzz I heard Dev was easyer to work with... I have yet to see that proven except it will run standard code better than my old Borland. I hate being behind the curve in learning a new compiler !!!

Tim
code happens
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I'm curious, did you not just try double clicking on one of the dev-cpp project files in the examples directory?
If they don't work out of the box then that's a bug!

Also, Dev-C++ is pretty old and no longer updated, the open source flavour of the month (past few years) is code::blocks, which is a much nicer IDE (imo)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

I did... none of them compiled correctly. So I took one of the basic tuttorials with the list of linker files and tried to work my way backards from there.
From the looks of it it may have been the simple changing the s32 to u32... I saw that in another forum and didnt think anything of it becouse there was no explination

I have not heard of code::block untill I hit this forum group. it looks like an inhanced struct class manipulator... is there a site I can look furthr into it ??

Tim
code happens
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Yep, you can get a copy here:
http://www.codeblocks.org/

It has the advantage of running on Windows and Linux, it uses the same project files for both
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply