I need a tutorial to compile Irrlicht + CodeBlocks + DirectX

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
stash
Posts: 47
Joined: Wed Dec 12, 2007 11:28 am
Location: Brasil, SC

I need a tutorial to compile Irrlicht + CodeBlocks + DirectX

Post by stash »

Hello
I´m a neewbie programmer C++ and I´m using codeblocks. I need a detailed tutorial to compile Irrlicht with CodeBlocks and with support to DirectX 9.
Can any help me? Thanks.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Hmm... OK, let's see (I'm typing as I try this):

I'm assuming that you're using Irrlicht 1.4.2.

Open source\Irrlicht\Irrlicht_Win32-gcc.cbp in Code::Blocks.

Right click on Irrlicht, and select Build Options.

Select the Compiler settings tab, and the #defines sub-tab. Add:

_IRR_COMPILE_WITH_DIRECT3D_9_
__GNUWIN32__

(I'm not sure why __GNUWIN32__ was missing; I think we just didn't maintain the C::B projects very well).)

Select the Search directories tab.

Select the Compiler sub tab. Hit Add and add the path to your DXSDK include directory. For example, I added this:

C:\Program Files\Microsoft DirectX SDK (June 2006)\Include


Close down the Build Options dialog.

In the Build target dropdown in the build bar, select "Debug" (rather than "All"),

Right click on the Irrlicht project, and select "Rebuild".

That should get you a bin/Win32-gcc/libIrrlicht.a bin/Win32-gcc/Irrlicht.dll with D3D9 support.

Unfortunately, libIrrlicht.a is built the wrong place, so move or copy it from /bin/Win32-gcc to /lib/Win-gcc

After doing that, I can build and run the example .cbp projects and use the D3D9 device.

Curiously, I didn't have to link Irrlicht against d3d9.lib, which I find somewhat worrying, but it does seem to work. :?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
psychophoniac
Posts: 101
Joined: Wed Dec 03, 2008 5:33 pm
Location: ger

Post by psychophoniac »

ah thanks. you should stick this maybe, i searched the forum and all i found was too short or not really up to date.
i love skateboarding!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Or one of those lazy dev slackers could add it by default to the Win32 C::B targets, since if you're building on and for Windows, you're likely to have a DXSDK.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
stash
Posts: 47
Joined: Wed Dec 12, 2007 11:28 am
Location: Brasil, SC

Post by stash »

Fantastic! Guys, you´re really helped me!! Thanks!

A new question: the Irrlicht.dll size now is 30Mb.. can I rebuild this DLL, with DirectX support with a smaller size?
wyrmmage
Posts: 204
Joined: Sun Mar 16, 2008 3:12 am
Contact:

Post by wyrmmage »

Are you compiling with debug symbols turned on? This is often the cause of a huge dll or executable :)
-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com
Ganadu'r, The Eternal Sage (Other Current Project) - http://rpg.naget.com
magfuse
Posts: 12
Joined: Sun Dec 21, 2008 9:06 pm

DirectX using gcc with Code Blocks

Post by magfuse »

I am trying to get DirectX support in the Irrlicht.dll so I installed DirectX 9c SDK and when I compile there are no errors but a window pops up with the message "You must select a host application to "run" a library..."

I am not sure it successfully compiled...

UPDATE: Thanks to Switchcase I know understand that this happens when you build and run... just building remedies the problem.
Last edited by magfuse on Tue Dec 23, 2008 11:38 am, edited 1 time in total.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Search the forum for IrrDX and you should find a thread which provides Irrlicht.dlls compiled with DX.
Image Image Image
magfuse
Posts: 12
Joined: Sun Dec 21, 2008 9:06 pm

Building the irrlicht dll with directX 9 support in Irr 1.5

Post by magfuse »

rogerborg wrote:Hmm... OK, let's see (I'm typing as I try this):

I'm assuming that you're using Irrlicht 1.4.2.

Open source\Irrlicht\Irrlicht_Win32-gcc.cbp in Code::Blocks.

Right click on Irrlicht, and select Build Options.

Select the Compiler settings tab, and the #defines sub-tab. Add:

_IRR_COMPILE_WITH_DIRECT3D_9_
__GNUWIN32__

(I'm not sure why __GNUWIN32__ was missing; I think we just didn't maintain the C::B projects very well).)

Select the Search directories tab.

Select the Compiler sub tab. Hit Add and add the path to your DXSDK include directory. For example, I added this:

C:\Program Files\Microsoft DirectX SDK (June 2006)\Include


Close down the Build Options dialog.

In the Build target dropdown in the build bar, select "Debug" (rather than "All"),

Right click on the Irrlicht project, and select "Rebuild".

That should get you a bin/Win32-gcc/libIrrlicht.a bin/Win32-gcc/Irrlicht.dll with D3D9 support.

Unfortunately, libIrrlicht.a is built the wrong place, so move or copy it from /bin/Win32-gcc to /lib/Win-gcc

After doing that, I can build and run the example .cbp projects and use the D3D9 device.

Curiously, I didn't have to link Irrlicht against d3d9.lib, which I find somewhat worrying, but it does seem to work. :?
Is there an update for this tutorial using irrlicht 1.5? I compiled w/ no errors but I am not getting a Irrlicht.dll with direct x support. I tried debug, accurate, and fast targets w/ no luck.

I get warnings when building the examples that pragma statements are being ignored but there are no warnings when I build the irrlicht.dll

The precompiled dlls that come with 1.5 under bin\gcc or bin\win32-gcc do not have directx either. =/ But, the IrrDX 1.5 precompiled dll works fine for me. I want to be able to compile my own dll since I downloaded the DirectX SDK.
Jiang
Posts: 77
Joined: Tue Feb 20, 2007 11:03 am

Re: Building the irrlicht dll with directX 9 support in Irr

Post by Jiang »

Hey magfuse,
magfuse wrote: Is there an update for this tutorial using irrlicht 1.5? I compiled w/ no errors but I am not getting a Irrlicht.dll with direct x support. I tried debug, accurate, and fast targets w/ no luck.

I get warnings when building the examples that pragma statements are being ignored but there are no warnings when I build the irrlicht.dll

The precompiled dlls that come with 1.5 under bin\gcc or bin\win32-gcc do not have directx either. =/ But, the IrrDX 1.5 precompiled dll works fine for me. I want to be able to compile my own dll since I downloaded the DirectX SDK.

I just added a build tool for irrlicht to sf.net. It can build irrlicht 1.5 and the latest svn using Code::Blcoks + MingW GCC + Direct3D9, for both static (.a) and shared library (.dll) without any problem. You can download it at
irrBuild @ sf.net

, and check the announcement at

irrlicht forum announcement

In my mind, the only thing you should change is, tell the script your Direct3D SDK's path, that's all. And feel free to try other settings for your application/project.

HTH,

Jiang
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you also can try my IrrExtensions !!! ;)
it was created for C::B and can compile the engine out of the box with C::B, but it also can be used for DevCpp and MSVC++... ;)

it's mainly the same thing like Jiang's build tool, but you also can enable/disable many features of the engine and add some usefull extensions, if you like to...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
magfuse
Posts: 12
Joined: Sun Dec 21, 2008 9:06 pm

Post by magfuse »

Update: I managed to get the irrlicht.dll to compile with Code Blocks... I had many problems that might be good to list in case any one runs into the same problems..

Okay first was that I was using the using the Irrlicht.dll that was in the bin\Win32-gcc folder but I was updating the binary in the bin\gcc folder. linking issue causing me to use the wrong dll in my projects.

Second I placed

Code: Select all

#ifndef _IRR_COMPILE_WITH_DIRECT3D_9_
#define _IRR_COMPILE_WITH_DIRECT3D_9_
#pragma message("Compiling Irrlicht with support for DX9 is now enabled.")
#endif // _IRR_COMPILE_WITH_DIRECT3D_9_
at the top of IrrCompileConfig.h to make sure this was defined

Then I noticed that i still was building using IrrCompileConfig.h because no pragma message was displayed. Apparently the IDE thought everything was up to date and didn't build files that included IrrCompileConfig.h So I had to CLEAN WORKSPACE and it works!!

Except for one thing... high level shaders... im sure its a define somewhere. Or maybe my laptop gfx card doesn't support this??

Thanks for your help!
Post Reply