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

Sol's Graphics for Beginners

01 - Setting Up SDL with Dev-C++

(other platforms) (last revised 5. July 2005)

The Dev-C++ has changed after I wrote this tutorial, so you may end up having some problems. Dev-C++ development seems to have stalled, however, so I'm waiting for code::blocks to get a stable release out and will write a tutorial based on that instead.

Bloodshed Dev-C++ is a free, gcc/mingw based, C++ development environment for windows. It has some very interesting features, including very handy package management.

If you haven't done so yet, go to and download a recent installer for Dev-C++. Make sure you select the package that includes MingW. The version I used to write this tutorial was 5.0 beta 9.2 (

Run the installer. Once installed, you'll be greeted by the tip of the day window. Close it, and select 'check for updates/packages under the 'tools' menu:

You'll be greeted by the following dialog. Without changing any options, click on the button that says 'check for updates'.

After the list of updates has been found, find the 'SDL DevPak' in the list, and select it, like below. Click on the button that says 'download selected'.

Once downloaded, you'll be prompted to install the DevPak. There weren't any options when I did so, so click on 'next' whenever prompted.

Next, create a new folder under which you want to build the tutorial chapters. I created the folder 'tutorial' at the root of my 'D' drive. Decompress 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, in Dev-C++, create a new project through file->new->project. Select 'Windows Application', and make sure the 'C++ Project' is selected. You can change the project name if you want to; I use 'gp'.

Next, Dev-C++ will ask you to save the project in some location. Go to the tutorial folder created earlier. Right-click on the file listing, and select new->folder. Name this folder 'ch01'. Go to the folder and save the project ('' for me) in that folder.

Select all text (control-A) and delete it (del) to get rid of the template that Dev-C++ is offering you. Save the empty file (file->save).

Go to project options (project>project options). There, go to the 'parameters' tab. In the tab, add "-lmingw32 -lSDLmain -lSDL" to the linker options (without the quotes), like this:

(Note that all of the parameters start with -l, where 'l' is lowercase L instead of upper-case i).

Click on 'Ok'. Save the project through file->save all.

Finally, copy the 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