User forums > Help

Bug in SDL project wizard?

(1/2) > >>

mkborregaard:
I have a consistent problem trying to launch SDL projects in code::blocks.
When asked to specify the folder in which I have placed SDL, I get the error: "The folder seems valid, but this wizard could not find the file SDL.h in it".
The file is in there, in a subfolder ("include"). Is this a problem with the wizard?
When I just try to open a simple console application and type my SDL code there, I get numerous error messages from MinGW, which I interpret as the library not being linked (e.g. "undefined reference to CreatePalette@4"), although i link to "libSDL.a; libSDL.dll.a; libSDLmain.a", and have listed both the include and lib folders as "search directories".

The specifics:
I am running a windows system. SDL has been installed from sources using MSYS in the folder "C:\MinGW\MSYS\local" (lib and include folders). I direct the SDL wizard to "C:\MinGW\MSYS\local"; "SDL.h" is found in "C:\MinGW\MSYS\local\include".
I have tried setting a global variable "sdl" to the appropriate targets.
Thanks for any help

Edit:
The problem persists.
I have now tried the precompiled version of SDL, and changed the directories. I have also copied all the header files from the include folder to the SDL top folder (so that SDL.h is directly in the folder that I direct C::B to). This does not seem like an SDL issue, maybe a bug in the wizard? Or have I forgot something? Can anyone give me a little help here?

TDragon:
The missing functions come from the Win32 api. Search for them on MSDN to find the appropriate link libraries to add -- for instance, CreatePalette is linked from gdi32.lib (in C::B, add "gdi32" to the Link Libraries list in your project's linker options). Most of them will actually be resolved with the catch-all "-mwindows" linker option, actually.

mkborregaard:
I do not have gdi32.lib. I have libgdi32.a, but linking to that, or using the -mwindows option does not solve the problem.
Am I to understand that the SDL project wizard is officially not working? Or is this a local problem on my machine?

TDragon:
libgdi32.a is the MinGW equivalent of MSVC's gdi32.lib; adding "gdi32" to the link options as I recommended causes C::B to append "-lgdi32" to the link-time options which will bring in libgd32.a.

At any rate, the SDL wizard is slightly broken; by temporarily copying SDL.h to the <SDL>\include folder, then restoring it and fixing the paths in the project search directories to point to <SDL>\include\SDL, everything worked fine:

--- Code: ---mingw32-g++.exe -Wall  -g    -IG:\Libraries\SDL-1.2.12\include\SDL -IG:\MinGW\include  -c G:\Projects\test\main.cpp -o obj\debug\main.o
mingw32-g++.exe -LG:\Libraries\SDL-1.2.12\lib -LG:\MinGW\lib  -o debug\test.exe obj\debug\main.o    -lmingw32 -lSDLmain -lSDL.dll -luser32 -lgdi32 -lwinmm -ldxguid
Output size is 368.63 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings

--- End code ---
(The above is from the Build log with full command-line logging enabled.)

mkborregaard:
Thanks!

Navigation

[0] Message Index

[#] Next page

Go to full version