Compiling Irrlicht code::blocks and mingw gcc for 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
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Compiling Irrlicht code::blocks and mingw gcc for directx

Post by Asimov »

Hi all,

Been messing with Irrlicht in OpenGL and now I want to compile it for directx9
I followed the steps layed out here http://irrlicht3d.org/wiki/index.php?n= ... 9WithMinGW

At first I was getting errors, but realised I made a stupid mistake and instead of linking to the include dir, I added the root directx9 sdk dir.

Anyway finally I manage to compile using "rebuild all" as build gives me an error "you must select a host application to "run" a library, but to cut a long story short it does compile
and makes the irrlicth.dll in Win32-gcc. It compiled with no errors and 131 warnings.

So I copy this dll to my bin folder of my application and I try to run directx, but I get an error that directx is not included in this library again.

I am attaching a screen shot. I wonder if anyone can look at my settings to see where I am going wrong.
Image
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Compiling Irrlicht code::blocks and mingw gcc for direct

Post by CuteAlien »

You are going to have an easier time using VisualStudio if you only do Windows development.
But anyway - to get it working in C::B you have to enable the _IRR_COMPILE_WITH_DIRECT3D_9_ define. Now usually the way that was done was by installing DX packages for MinGW and not using the official SDK. And then adding the IRR_COMPILE_WITH_DX9_DEV_PACK define either to IrrCompileConfig.h or passing it to the compiler with -DIRR_COMPILE_WITH_DX9_DEV_PACK or in the case of C::B you can also pass defines in some dialog directly (build-options, compiler-settings, defines).

I'm not sure if the same will work when you use the official SDK - it tended to have different kind of troubles over the years in combination with MinGW and C::B (MS rarely makes it easy to use their tools together with other tools). But you might be lucky - just try using that define. If it doesn't work you have to figure out how to install a DX package which works with MinGW. I got it working once for DX8 and DX9. But after a while decided to stay mostly with OpenGL and just use VisualStudio whenever I needed DirectX. And it's been too long ago to still remember how I got it working (probably found the packages over MinGW homepage or SF or maybe even official MS SDK worked last time). And it tends to change all the time, no idea if it even still works with newer Windows versions (never tried it with Windows 8).

Just in case you don't know - there is a new and free Visual Studio Community 2013 out. And from experience I can tell you that you'll get used to the interface of VS 2013 very fast and for Windows only development it's a lot more comfortable than Code::Blocks (I really love C::B and especially that it's opensource... but it's getting further and further behind VS featurewise).
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
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Compiling Irrlicht code::blocks and mingw gcc for direct

Post by Asimov »

Hi CuteAlien,

I will give it another go.

By the way on my previous laptop I had the full visual studio 2010 which I used with XNA, directx and another C++ framework I used. In the past I used Code::blocks with another engine called SDL, and I was impressed with it's simplicity. Another reason I use code::blocks was visual studio kept trying to add overheads to my projects, whereas code::blocks didn't.

Anyway the reason I suddenly went back to code::blocks was after installing visual studio 2012, I hated it. I still have visual studio 2010 I could install, but 2012 was horrible, and I don't suppose 2013 will be any better. It is almost like they designed it to look nice on Windows 8 with no borders and stuff. My thing is this. If it is on windows it should have a window. Which is another reason why I refuse to upgrade from Windows 7 to Windows 8. I might try windows 9 if they get rid of that horrible metro interface designed for children.

Does irrlicht work with visual studio 2010 ok? Because if I can't get it to work with directx in codeblocks, then I would prefer to use 2010 than 2012.

By the way I haven't always been stuck to windows, I stuck with Amiga OS for a hell of a long time before I succumbed to windows. Even had 2 of my amiga games on a CU Amiga cover disk.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Compiling Irrlicht code::blocks and mingw gcc for direct

Post by CuteAlien »

Yeah, I still use VS2010 here myself. For pretty much the same reason - I didn't like the VS 2012 interface :-) But I had to work recently with VS2013 in a job and it really only took me 1-2 days and I didn't even notice the new interface anymore. And I started to love some of the new features in 2013. Thought I guess it mostly shines once your projects get larger (stuff like filtering files in the solution explorer, tiny feature, but I used it non-stop!).
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
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

Re: Compiling Irrlicht code::blocks and mingw gcc for direct

Post by AReichl »

Maybe i can help here. I have everything working in all combinations of compilers ( gcc, VS2010, VS2013 ) and IDEs ( Visual Studio, CodeBlocks, Netbeans, Eclipse ). Only exception is DirectX11 in the shader-pipeline branch. Even with VS2013, where the DirectX-SDK is included in the "Microsoft SDKs", it won't compile.

My "advise" would be to ignore DirectX for now. Not because you have trouble compiling it, but OpenGL is good enaugh and if you are getting into shaders, you will have to learn only one language first (GLSL). That is learning ( and trouble ) enaugh for the beginning! And don't compare the "frames per second" of a program between DirectX and OpenGL - it's not worth the hassle.

Recently i read some articles saying OpenGL having more potential for future development ( architecture more flexible ). There are some great engines out there which ONLY support OpenGL, and rightly so, because they can concentrate on it. Maybe then Nadro would have an easier job too. As one game developer said: when i began to ignore DirectX i was free to do it right.

But of course there are the customers ( ask CuteAlien ) which demand DirectX and use Irrlicht because it supports it. Stuck again.

If you want DirectX support in Irrlicht, use the "Microsoft DirectX SDK (June 2010)". Define IRR_COMPILE_WITH_DX9_DEV_PACK and NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ and you are fine to go.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Compiling Irrlicht code::blocks and mingw gcc for direct

Post by Asimov »

Hi Areichi,

Thanks for the advice. I might just use OpenGl on a futue project, but on this one I have in mind I want directx.
In any case I would like the option of both. I haven't had time to look into this today, been having some trouble with a php and jquery project I am working on.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Compiling Irrlicht code::blocks and mingw gcc for di

Post by Asimov »

Hi Areichi,

You are a hero, I just got it compiled. Your last sentence was the one that got it working.
This line was in the tutorial
Define IRR_COMPILE_WITH_DX9_DEV_PACK

but this line wasn't
NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_

and that was the one that got it working.

Thanks a lot. Now I can start playing with the engine again :D
Post Reply