Code::Blocks, mingw, and "need to define an architectur

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
walkeraj
Posts: 3
Joined: Thu Sep 27, 2007 2:30 am

Code::Blocks, mingw, and "need to define an architectur

Post by walkeraj »

Okay, so maybe this isn't possible, and it's just me trying to be a big, free-tool-using hippy, but I'm trying to build Irrlicht with directx9 support using MinGW and CodeBlocks. The main reason I was trying to do this was because I kept getting an error when compiling the default hello world project if I tried to say:

Code: Select all

createDevice(EDT_DIRECTX9, dimension2d<s32>(640, 480), 16,
            false, false, false, 0);
The error was:

Code: Select all

In function `int main(int, char**)':
error: `EDT_DIRECTX9' undeclared (first use this function)
Oh noes!:shock:

So, I figured that was because I wasn't compiling irrlicht with directx9 support. So, I loaded up the codeblocks project to compile irrlicht and made the following changes:

In Linker Settings -> Link Libraries:
added d3d9.lib

In Search Directories -> Compiler:
added C:\CODE\libraries\DXSDK\Include
added C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include

In Search Directories -> Linker:
added C:\CODE\libraries\DXSDK\Lib
added C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Lib

in Compiler Settings -> #defines:
added -DIRR_COMPILE_WITH_DX9_DEV_PACK

in IrrCompileConfig.h:
commented out #define _IRR_COMPILE_WITH_DIRECT3D_8_

Then, I hit "build", and it went on its merry way. Until...

Code: Select all

:: === Irrlicht, default ===
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h:214: warning: "_cdecl" redefined
:83:1: warning: this is the location of the previous definition
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\winnt.h:741: #error Must define a target architecture.
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\oaidl.h:441: pasting "/" and "/" does not give a valid preprocessing token
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\oaidl.h:441: error: expected unqualified-id before '/' token
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\oaidl.h:456: pasting "/" and "/" does not give a valid preprocessing token
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\oaidl.h:456: error: expected unqualified-id before '/' token
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\propidl.h:309: pasting "/" and "/" does not give a valid preprocessing token
C:\CODE\libraries\Microsoft Platform SDK for Windows XP SP2\Include\propidl.h:309: error: expected unqualified-id before '/' token
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:: In member function `virtual bool irr::video::CD3D9Driver::beginScene(bool, bool, irr::video::SColor)':
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:467: error: expected primary-expression before ',' token
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:: In member function `virtual bool irr::video::CD3D9Driver::endScene(irr::s32, irr::core::rect<irr::s32>*)':
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:509: error: expected primary-expression before ',' token
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:509: error: expected primary-expression before ')' token
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:: In member function `virtual bool irr::video::CD3D9Driver::setRenderTarget(irr::video::ITexture*, bool, bool, irr::video::SColor)':
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:758: error: expected primary-expression before ',' token
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:: In member function `virtual void irr::video::CD3D9Driver::drawStencilShadow(bool, irr::video::SColor, irr::video::SColor, irr::video::SColor, irr::video::SColor)':
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:1825: error: expected primary-expression before ',' token
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:: In member function `virtual void irr::video::CD3D9Driver::clearZBuffer()':
C:\CODE\libraries\irrlicht-1.3.1\source\Irrlicht\CD3D9Driver.cpp:2067: error: expected primary-expression before ',' token
:: === Build finished: 13 errors, 2 warnings ===
Oh noes again! :shock:

So. What have I done wrong? Is the Microsoft SDK just not compatible with GCC or what? Please feel free to go into as much detail as possible. I want to know not only what I did wrong but WHY it's wrong.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You don't need the platform SDK for mingw, it has it's own headers.
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post by shogun »

walkeraj wrote: The error was:

Code: Select all

In function `int main(int, char**)':
error: `EDT_DIRECTX9' undeclared (first use this function)
Oh noes!:shock:

So, I figured that was because I wasn't compiling irrlicht with directx9 support.
Well, that's wrong. EDT_DIRECTX9 was renamed to EDT_DIRECT3D9.
walkeraj
Posts: 3
Joined: Thu Sep 27, 2007 2:30 am

Post by walkeraj »

Think I'm making some progress here. Now there are a few linker errors:
.objs\CD3D9ShaderMaterialRenderer.o:CD3D9ShaderMaterialRenderer.cpp:(.text+0x867):: undefined reference to `D3DXAssembleShader@28'
.objs\CD3D9ShaderMaterialRenderer.o:CD3D9ShaderMaterialRenderer.cpp:(.text+0x8c9):: undefined reference to `D3DXAssembleShader@28'
.objs\CD3D9ShaderMaterialRenderer.o:CD3D9ShaderMaterialRenderer.cpp:(.text+0xa09):: undefined reference to `D3DXAssembleShader@28'
.objs\CD3D9ShaderMaterialRenderer.o:CD3D9ShaderMaterialRenderer.cpp:(.text+0xea0):: undefined reference to `D3DXAssembleShaderFromFileA@24'
.objs\CD3D9ShaderMaterialRenderer.o:CD3D9ShaderMaterialRenderer.cpp:(.text+0xefc):: undefined reference to `D3DXCompileShader@40'
.objs\CD3D9ShaderMaterialRenderer.o:CD3D9ShaderMaterialRenderer.cpp:(.text+0xf55):: undefined reference to `D3DXCompileShaderFromFileA@36'
:: === Build finished: 6 errors, 0 warnings ===
So, it's a library I'm not properly linking against, but I'm not sure which one it is. Just to clarify, Irrlicht CAN be compiled with mingw to have both OpenGL and Drectx9 capabilities, right?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, you need the d3dx9 lib from DirectX SDK. You will have to change it with some mingw tools first, though, due to different name mangling. You can use the dx9 devpak instead which should work, too. DX8 does not work in most cases, though.
mandrav
Posts: 117
Joined: Sat Aug 27, 2005 8:29 pm
Contact:

Post by mandrav »

walkeraj wrote: Just to clarify, Irrlicht CAN be compiled with mingw to have both OpenGL and Drectx9 capabilities, right?
Yes. Works with DX libs as they come with the DX SDK (no need to convert them or anything). At least gcc-3.4.5 worked with them, last time I tried (which is admittedly a year ago, or so).
Post Reply