Download the latest version of Code::Blocks from http://www.codeblocks.org/downloads/26 or directly click here to download 10.05 and install it in your system.
Now time to setup
Step 1: Download SDL libraries
- Go here: http://www.libsdl.org/download-1.2.php
- Find the header entitled "Development Libraries"
- Under Win32, choose the option that says (Mingw32) after it. The current one at the time of writing this article is "SDL-devel-1.2.12-mingw32.tar.gz", but there may be a newer version when you try. Click on this and download it to your desktop.
- For more libraries to link on SDL, Download SDL_image-devel-1.2.10-VC ,SDL_mixer-2.0.10-VC , SDL_ttf-devel-2.0.10-VC etc.
Step 2: Uncompress the downloaded .tar.gz file
If you do not have an application that can decompress this type of file, you can get one here: http://www.7-zip.org/download.html You will want to uncompress it into its own folder, so that we can manually copy the files we need into the CodeBlocks folder.Step 3: Copy the files from the uncompressed folder to your CodeBlocks folder
Copy the respective folders of downloaded sdl libraries to the CodeBlocks folder.Now time to setup
- Here I have made a folder for me in C drive which contains all the libraries for SDL.
Path:- C:\Ashok Programs\SDL Library\SDL-1.2.14\include
- Go to Setting->Compiler and Debugger and go to Tab Search Directories so that codeblocks will search for the include folder or library folder in the location that we have set.
-> Search Directories for Compiler
-> Search Directories for Linker
- In the linker setting tab, other linker tabs, add the linker libraries.
-lmingw32
-lSDLmain
-lSDL
- Now time to put dll(dynamic link libraries). You can put the dll files either in the System32 directory (i.e. C:\Windows\System32) or the in application folder itself (i.e. in project folder). Its good if you copy it to the project folder since during distribution you don’t need to search for them. But for testing purposes copying in system32 folder reduces the time for individual dll copying.
Copy the dll files from the bin folder of the libraries that you have downloaded.
- If you want other SDL components such as SDL image, SDL mixer etc. you need to download the library files as given in above link and extract the folder. Then copy the respective include folder contents to our main SDL Library folder and lib folder contens to SDL lib located at the main SDL library folder. and don’t forget to the dll files from bin folder to the system32 or project folder.
#include "SDL/SDL.h"
int main( int argc, char* args[] ) { SDL_Init( SDL_INIT_EVERYTHING ); //Start SDL SDL_Quit(); //Quit SDL return 0; }
Save the source and compile your project. If there are no errors, you're done. Otherwise go back and make sure everything is done. Double check that you have SDL.dll in the same directory as your exe or system32.
0 comments :
Post a Comment