Author Topic: directx project example doesn't work in codeblocks  (Read 3164 times)

michel

  • Guest
directx project example doesn't work in codeblocks
« on: January 19, 2018, 03:19:27 pm »
hi everybody, new in code::blocks, i'm trying to use directx with codeblocks. I've opened the project wizard, then choosen "direct/x project".
The main file is the one that is automatically created.

once file have been loaded in cb, i've tried to build. first, i have been compeled to erase "#include <strsafe.h>" because i got the message "strsafe.h no such file or directory".

Trying again, I get the following message  :


-------------- Build: Debug in dx (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -Wall -g -D_DEBUG -ggdb -I"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" -IC:\allegro-5.0.10-mingw-4.7.0\include -I"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" -I"C:\Program Files (x86)\CodeBlocks\MinGW\include" -IC:\codeblockprojet\dx -IC:\codeblockprojet\dx -c C:\codeblockprojet\dx\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -L"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib" -LC:\allegro-5.0.10-mingw-4.7.0\lib -L"C:\Program Files (x86)\CodeBlocks\MinGW\lib" -L"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64" -o bin\Debug\dx.exe obj\Debug\main.o  -lmingw32 -lSDL2main -lSDL2  -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -ld3d9 -ld3dx9 C:\allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-monolith-mt-debug.a C:\allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-monolith-mt.a "C:\codeblockprojet\essai flipper\iowkit.lib"
In file included from C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include/d3d9.h:290:0,
                 from C:\codeblockprojet\dx\main.cpp:1:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include/d3d9types.h:25:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4201) // anonymous unions warning
 ^
In file included from C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include/d3d9.h:290:0,
                 from C:\codeblockprojet\dx\main.cpp:1:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include/d3d9types.h:2411:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(default:4201)
 ^
In file included from C:\codeblockprojet\dx\main.cpp:1:0:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include/d3d9.h:2025:1: warning: "/*" within comment [-Wcomment]
 /* D3D9Ex interfaces
 ^
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include/d3d9.h:2026:1: warning: "/*" within comment [-Wcomment]
 /*********************/
 ^
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: cannot find -lSDL2main
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: cannot find -lSDL2
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 3 second(s))
3 error(s), 4 warning(s) (0 minute(s), 3 second(s))

Does anybody could help me in succeded to make the example program work? Thanks
 

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: directx project example doesn't work in codeblocks
« Reply #1 on: January 19, 2018, 05:16:08 pm »
What version of codeblocks are you using?

Why do you have added the SDL libraries (they where not added by the wizard script)? Remove them from the linker libraries and it should work, or install the SDL library and point the linker path to it...

To point the linker to the SDL libraries: Project->Build options->Search directories->Linker->Add->PAHT_TO_SDL_LIBRARY