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.  

Step 1: Download SDL libraries

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

  1. Here I have made a folder for me in C drive which contains all the libraries for SDL.
    Path:- C:Ashok ProgramsSDL LibrarySDL-1.2.14include
    folder structure
  2. 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
    path1
    -> Search Directories for Linker
    path2
  3. In the linker setting tab, other linker tabs, add the linker libraries.
    -lmingw32
    -lSDLmain
    -lSDL
    linker
  4. Now time to put dll(dynamic link libraries). You can put the dll files either in the System32 directory (i.e. C:WindowsSystem32) 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.
  5. 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.

Create a new file in the project directory named.cpp and paste the following code

#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.