Page 1 of 2

Getting Irrlicht to work with Dev-C++

Posted: Sun Dec 27, 2009 5:59 am
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(...

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

Posted: Sun Dec 27, 2009 6:20 am
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

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

Posted: Sun Dec 27, 2009 6:42 am
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?

Posted: Sun Dec 27, 2009 8:12 am
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

Posted: Sun Dec 27, 2009 11:50 am
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.

Posted: Thu Dec 31, 2009 2:17 am
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

Posted: Thu Dec 31, 2009 8:00 am
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

Posted: Tue Jan 05, 2010 3:59 am
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

Posted: Tue Jan 05, 2010 12:24 pm
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);

Posted: Tue Jan 05, 2010 6:33 pm
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

Posted: Tue Jan 05, 2010 6:46 pm
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.

Posted: Tue Jan 05, 2010 7:09 pm
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

Posted: Tue Jan 05, 2010 7:12 pm
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)

Posted: Tue Jan 05, 2010 7:41 pm
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

Posted: Tue Jan 05, 2010 7:54 pm
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