Code::Blocks & SDL
Members - Reputation: 880
Posted 16 May 2012 - 03:41 AM
I downloaded Code::Blocks 10.05 (the package with MinGW/CGG) then followed these instructions http://wiki.codeblocks.org/index.php?title=Using_SDL_with_Code::Blocks#The_Process (downloaded SDL-devel-1.2.15-mingw32 instead 1.2.9 since that one was the newest).
Next, I created a project (selected "SDL project") and... it asks for "Please select SDL's location". I tried to put there the path to the whole SDL package (but then what was the point of copying these files manually to MinGW in previous steps?) but it still says "Can't locate SDL.h" (it's still the create project stage, no compilation or linking error).
Members - Reputation: 509
Posted 16 May 2012 - 04:21 AM
1. Set sdl variable BEFORE creating an SDL project. For me it crashes CB entirely or just did funny business in earlier versions.
To set sdl variable go to Settings->Global Variables, click New that's on the same line with Current Variable. Name it sdl. Set base to the directory where you unpacked the SDL package.
2. Create new SDL project with default values.
3. Build = if it works - great! If it doesn't then check under Project Options->Search Directories->Compiler and rename $(#sdl.include)\SDL to $(#sdl.include). Try again.
Edited by mrjones, 16 May 2012 - 04:27 AM.
Members - Reputation: 773
Posted 16 May 2012 - 06:10 AM
Just to be sure it'll work right you should probably restart the process and use the version that they suggested in the guide and see if that changes anything. If it works with 1.2.9 just stick with that one for now till you find a way to make CB work with the newest version.
(downloaded SDL-devel-1.2.15-mingw32 instead 1.2.9 since that one was the newest).
Members - Reputation: 880
Posted 16 May 2012 - 06:21 AM
Now, I wonder. I managed to add SDL_ttf similar way (global options then SDL_ttf to linker and $(#sdl_ttf.lib/include) to search directories). But the curious thing, for SDL to work there needs to be SDL.dll in MinGW bin directory, SDLmain and sdl.dll listed on linker page. But for SDL_ttf there only needs to be SDL_ttf on linker page (the dll is somehow automaticly added from the libs directory without setting anything)... I tried to do the same thing with SDL (copied sdl.dll to the SDL libs directory) but it is not working.
Members - Reputation: 133
Posted 16 May 2012 - 10:05 AM
Here is how to set up sdl -- http://lazyfoo.net/SDL_tutorials/lesson01/windows/index.php
and extensions, this is for SDL_image but it works for all the other extensions. -- http://lazyfoo.net/SDL_tutorials/lesson03/windows/index.php