1. Download and install Dev-C++ (http://www.bloodshed.net/devcpp.html), and be sure to get the version that includes MinGW.

  2. On the SDL (http://www.libsdl.org) download page, get the latest version of the MinGW development libraries.

  3. If you want to use the SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/) library (for sound and music), download the Windows development libraries for SDL_mixer. (At the time of this writing, MinGW specific libraries are not available on the SDL_mixer website (http://www.libsdl.org/projects/SDL_mixer/), but the VC6 libraries will work with Dev-C++.)

  4. Uncompress the SDL and SDL_mixer libraries to your local drive.
  5. Copy SDL.dll and libSDLmain.a from the SDL library into the \lib subdirectory of your Dev-C++ installation root.
  6. Create an \SDL directory in the \include subdirectory of your Dev-C++ installation root, and copy all of the SDL header files into this new directory.
  7. Copy SDL_mixer.dll from the SDL_mixer library into the \lib subdirectory of your Dev-C++ installation root.
  8. Copy the SDL_mixer.h header file into the \include\SDL subdirectory of your Dev-C++ installation root.

Your build environment is now set up. To create an SDL project, perform the following steps.

  1. Open Dev-C++ and from the File menu, select New→Project.

  2. Click on the Empty Project icon, give your project a name, and click Ok.
  3. Use the file browser to decide where to save your project's DEV file, and click Save.
  4. Under the Project menu, select Project Options.
  5. Click the Parameters tab, and in the Linker textbox enter "-lmingw32 -lSDLmain -lSDL -lSDL_mixer" (without the quotes) then click Ok.
    • NOTE: If you do not want the console window to appear when your program runs, you will need to add -mwindows to the end of your linker string!
  6. You can now use Dev-C++ to add your source code to the project. When you're done, from the Execute menu, select Compile. This will create an executable file in your project's root directory.
  7. Before you can run the executable, you will need to copy SDL.dll and SDL_mixer.dll to your project's root directory, or if you prefer, you can copy the two DLLs to your \windows\system or \windows\system32 folder. Windows must be able to find the DLLs, or you'll get an error when you attempt to run the executable.

This document was copied from The Game Programming Wiki's SDL build environment setup page, according to the GNU FDL license.

FAQ_Compiling_on_Dev-C++ (last edited 2008-04-17 08:18:51 by localhost)