Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: antonien on January 25, 2011, 09:20:25 pm

Title: Using DirectX with Code::Blocks
Post by: antonien on January 25, 2011, 09:20:25 pm
Hi everybody

I made a search on the forum but couldn't find a definite answer to my question.
May I use DirectX with Code::Blocks as it is (i.e with MinGW as compiler) or do I have to change for another compiler (some Microsoft stuff) ?
If I have to, is there a comprehensive tutorial which explains how to do it ?
I am not very familiar with installation (actually I am panicked when I have to do this kind of stuff). Do I have to uninstall Code::Blocks to do it ?
Is there a difference of behaviour between a program compiled with MinGW and the same program compiled with another compiler ?

Thanks for the answer if any.

Best Regards.
antonien
Title: Re: Using DirectX with Code::Blocks
Post by: MortenMacFly on January 25, 2011, 09:53:34 pm
May I use DirectX with Code::Blocks as it is (i.e with MinGW as compiler) or do I have to change for another compiler (some Microsoft stuff) ?
The Direct/X SDK works perfectly with MinGW. All you need to do is the usual setup. First install the SDK itself, then use e.g. the Direct/X wizard of C::B to get yourself an example project stub and go ahead.
Title: Re: Using DirectX with Code::Blocks
Post by: antonien on January 25, 2011, 10:14:39 pm
Thanks a lot for your quick answer. I read that I had to use some utility to convert the .lib files and that was enough for me to be upset.
I'll try the Direct/X wizard.
I use also wxWidgets (and I like it !). I guess I'll have to do some stuff to combine both : there is no wizard to make it for me...

Thanks again, I feel more comfortable.
Regards
Title: Re: Using DirectX with Code::Blocks
Post by: MortenMacFly on January 26, 2011, 07:51:17 am
Thanks a lot for your quick answer. I read that I had to use some utility to convert the .lib files and that was enough for me to be upset.
There is no need for any conversion. MinGW can handle the windows library files (*.lib) just fine!

BTW: No, we don't have a wizard for each and every combination (;-)). However, there is plenty code around at "the Google" which combines Direct/X with wxWidgets as a starter...
Title: Re: Using DirectX with Code::Blocks
Post by: stahta01 on January 26, 2011, 02:07:16 pm
There is no need for any conversion. MinGW can handle the windows library files (*.lib) just fine!

When did this happen?
I know MinGW can handle C DLLs.

The old link I used to post for MinGW DirectX Library
http://mamedev.org/tools/previous-20070810.html

The new link
http://mamedev.org/tools/

Tim S.
Title: Re: Using DirectX with Code::Blocks
Post by: MortenMacFly on January 26, 2011, 06:03:11 pm
There is no need for any conversion. MinGW can handle the windows library files (*.lib) just fine!
When did this happen?
I don't know, but I am doing this a lot at work. All direct/x related apps are linked against the MS SDK without issues.

I wasn't aware that this was not possible earlier... :shock: Probably the functions I am using are MinGW friendly in the first place... (well I did modify some of the header myself though...)
Title: Re: Using DirectX with Code::Blocks
Post by: stahta01 on January 26, 2011, 07:35:45 pm
Hi everybody

Is there a difference of behaviour between a program compiled with MinGW and the same program compiled with another compiler ?


Yes, if the programmer is not doing his/her job right; And sometimes yes, if the program is using complex library that has different support between compilers.

Title: Re: Using DirectX with Code::Blocks
Post by: antonien on January 26, 2011, 09:50:24 pm
I am progressing slowly. I used the DirectX wizard, I replaced <strsafe.h> by <cstddef> as advised somewhere else, I removed the "L" before any string to make it compile... and linking failed :

mingw32-g++.exe -LC:\CodeBlocks\DirectX\lib  -o bin\Debug\Directxtest.exe obj\Debug\main.o    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -ld3d9 -ld3dx9 C:\CodeBlocks\DirectX\Lib\x64\d3dx9.lib
c:/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -ld3dx9
What's that ?
d3dx9.lib is sitting in the lib directory and this directory is made available to the linker.

Any idea of what happens ?

Thanks in advance.
Title: Re: Using DirectX with Code::Blocks
Post by: ironhead on January 27, 2011, 12:43:22 pm
I am going to assume this was all one line (i.e. the d3dx9.lib reference was at the end of the line):

mingw32-g++.exe -LC:\CodeBlocks\DirectX\lib  -o bin\Debug\Directxtest.exe obj\Debug\main.o    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -ld3d9 -ld3dx9 C:\CodeBlocks\DirectX\Lib\x64\d3dx9.lib

The '-ld3dx9' isn't required if you are passing in d3dx9.lib, in fact it's causing this error:

c:/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: cannot find -ld3dx9

Because MinGW is looking for libd3dx9.a.  You can drop -LC:\CodeBlocks\DirectX\lib if you are passing in the absolute path of the library.
Title: Re: Using DirectX with Code::Blocks
Post by: antonien on January 27, 2011, 09:22:25 pm
Thanks for the answer : I did remove d3dx9 from the linker settings (actually, I didn't know it was there : it's the wizard who did that for me).

Next stop : winmain@16

Undefined reference to WinMain@16 !
Couldn't find any reference to that WinMain@16...

I am getting fed up with MinGW...

If anybody has a cue, I'll be gratefull.

Best regards
Title: Re: Using DirectX with Code::Blocks
Post by: stahta01 on January 28, 2011, 01:15:43 am
Learn to use Google; this thread needs to be locked because it is no longer a topic valid for this site!
http://mingw-starter.blogspot.com/2008/02/mingw-sdl.html

Tim S.
Title: Re: Using DirectX with Code::Blocks
Post by: pixelpuffin on November 13, 2013, 09:41:16 pm
i had the same problem with d3dx9
how did you remove it from the linker
sorry if this is a stupid question im a bit new
Title: Re: Using DirectX with Code::Blocks
Post by: BlueHazzard on November 13, 2013, 10:10:20 pm
Project->Build Options->Linker settings
Title: Re: Using DirectX with Code::Blocks
Post by: pixelpuffin on November 13, 2013, 10:38:39 pm
theres nothing in linker settings though
Title: Re: Using DirectX with Code::Blocks
Post by: BlueHazzard on November 13, 2013, 10:42:46 pm
probably you have to mark the project name target:
Project->Build Options->Linker settings-> The project name on the left
greetings
Title: Re: Using DirectX with Code::Blocks
Post by: pixelpuffin on November 13, 2013, 11:17:29 pm
the project name has been on the left the entire time im under debug right now
Title: Re: Using DirectX with Code::Blocks
Post by: BlueHazzard on November 13, 2013, 11:56:55 pm
check all three. Somewhere is the linker flag set...
Title: Re: Using DirectX with Code::Blocks
Post by: pixelpuffin on November 14, 2013, 01:50:07 am
i did check all three none had it (sorry for long response time)
Title: Re: Using DirectX with Code::Blocks
Post by: pixelpuffin on November 14, 2013, 04:08:01 am
:/ i need to fix this by monday morning so that i can start coding
Title: Re: Using DirectX with Code::Blocks
Post by: oBFusCATed on November 14, 2013, 09:10:47 am
Read this:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Then read tutorials how to use DX with MinGW. Then match the settings.

@admins: please move the topic to more appropriate place