email sol follow sol rss feed of the blog wishlist Sol::Tutorials

Sol's Graphics for Beginners

01 - Setting Up SDL with VC6

(other platforms)

First, I created a new folder at the root of my 'D' drive called 'tutorial', and decompressed the SDL development package to it, like so:

Note that the SDL zip contains the SDL-1.2.7 folder, so make sure you don't have any extra folders between 'tutorial' and the SDL directory. The directory structure should look like this:

As you see, SDL comes with its own documentation, reading of which I do recommend. But you'll have time for that later. Next, fire up visual studio.

In visual studio, start a new project. Select 'Win32 Application' and set up the paths and project name as shown. Note that when typing in the project name, visual studio automatically names the directory with the same name, so you'll need to edit the path after giving the project a name if you're following this tutorial to the letter.

When prompted, make sure you're creating an empty project. Other than that, accept the defaults.

In order to use SDL, we need to set up some project settings. So, go to 'settings..' in the 'project' menu. Select 'C/C++ tab', category Code Generation. Under 'Use run-time library', select 'Debug Multithreaded DLL'.

Next, select 'Preprocessor' as category, still in the 'C/C++' tab, and add "..\SDL-1.2.7\include\" (without quotes) in the 'Additional include directories' field.

Then, select the 'Link' tab. Add "SDLmain.lib sdl.lib" (again without quotes) at the beginning of the 'Object/library modules' list.

Still in the 'Link' tab, select 'Input' category and add "..\SDL-1.2.7\lib\" (yes, without quotes) to the 'Additional library path' field.

Click OK to accept the changes. Note that we've only changed the debug build settings, so, when you want to make a release build, you will have to do the same changes to the release build settings. (Except that you'll need Multithreaded DLL instead of Debug multithreaded DLL as the run time library).

Add a new file to the project. One way to do this is through file->new->C++ Source File. Name the file main.cpp. Save the empty file.

Next, copy SDL.dll from SDL-1.2.7\lib to the ch01 directory.

After that, you are ready for 02 - SDL Skeleton and Putting Pixels..

Having problems? Try the forums!

Any comments etc. can be emailed to me.

Site design & Copyright © 2017 Jari Komppa
Possibly modified around: April 29 2010