The first step to getting started using the SDL is to download the libraries. These libraries are required to building applications that use the SDL. The libraries can be downloaded from http://www.libsdl.org/download-1.2.php. At the bottom of the page, you should see this section.
Note: Since we are using Visual C++ 2008 Express Edition, download the Visual C++ 2005 Service Pack 1 zip file.
After you have downloaded the libraries, extract the contents to wherever you want on your computer. Just remember where because it will be very important.
Now we will set up Visual C++ Express Edition to use these libraries in our future SDL projects. Open up Visual C++ and click on Tools and then Options. It should look like this:
Expand the 'Projects and Solutions' category and select 'VC++ Directories'. Under the 'Show directories for:' drop down box, select 'Include files'.
Now, select the 'New Line' button (Highlighted with the red circle) and then the button with 3 dots (Highlighted with the green circle). This will let you browse the files on your computer. Select the 'include' folder in the SDL folder you extracted previously. It should be something like: SDL-1.2.14\include
Now, under the 'Show directories for:' drop down box, select 'Library files'. Do the same action you did in the previous step. Select the 'New Line' button and then the button with 3 dots to browse for the lib folder. Select the 'lib' folder in the same SDL folder that contained the 'include' folder. It should be SDL-1.2.14\lib.
Only one item remains in order for you to be using the SDL in your applications, the SDL.dll file. You can copy this .dll file to the folder containing the source code of your application (it will look like: application name\debug\sdl.dll). You can also copy the file to your Windows\System32 folder (or Windows\SysWOW64 if you are running a 64-bit version of Windows). The problem with this is that there are different versions of the SDL and if you have a conflicting version of the SDL.dll file in the Windows folder, version conflicts could arise. You will need to distribute a copy of the SDL.dll file with your applications anyways for it to run so I recommend not copying it to the Windows folder.
You are now ready to start using the SDL in your applications. Part 2 of this tutorial will begin to explain the basics of the SDL and how you can use it in your game applications.
Back to SDL Tutorial Index
Back to Main Page