Wednesday, July 6, 2011

Setting up SDL in codeblocks

  • First of all you've to download SDL headers and binaries. The download is available at http://www.mediafire.com/?ce02ii51rvoxezm
  • After downloading, extract the zip file.
  • Copy the contents of include folder and open ...\CodeBlocks\MinGW\include folder where your codeblocks has been installed ( such as C:\Program Files (x86)\CodeBlocks\MinGW\include). Create a new folder named SDL and paste the copied contents inside it.
  • Copy the contents of bin folder and paste it inside C:\Windows\System32.
  • Repeat the above step for lib folder. Paste the contents inside ...\CodeBlocks\MinGW\lib.
  • Start up Code:Blocks and go to the Compiler and Debugger settings.
  • Go to the Compiler tab under Search Directories. Click add:
  • then add in the include directory where you before copied the the include folder contents (say C:\Program Files (x86)\CodeBlocks\MinGW\include\SDL).
  • Then under the linker tab add in the lib directory ( say C:\Program Files (x86)\CodeBlocks\MinGW\lib).
  • Then after under linker settings, in other linker options paste
-lmingw32
-lSDLmain
-lSDL
-lSDL_image
-lSDL_ttf
-lSDL_mixer



Now you are ready to work on SDL with image, sound and fonts.

No comments:

Post a Comment