jnrdev howto - setup devcpp and sdl - Florian Hufsky

1. Introduction

recently i switched from vc++ to devcpp. it's easier to use. starts faster and is open source.
but it was confusing to set up sdl on devcpp, so i've written this howto.

2. Download the stuff you'll need

 - DevCpp 4.9.9.0 (7.6 mb) (http://www.bloodshed.net/)
 - SDL 1.2.7 mingw32 devel (0.7 mb) (http://www.libsdl.org)

3. Install DevCpp

just do it and remember the folder you've installed it to.

4. Install SDL

vixus (?) showed me an easy way to install sdl on devcpp: go to devpaks.org and download the sdl 1.2.7 devpak and install it.

here's the do it yourself way:

extract SDL-devel-1.2.7-mingw32.tar.gz to your devcpp folder.
make sure that the content gets directly in your devcpp folder and not to devcpp/SDL-devel/ etc.

to check if everything is where it should be see if libSDL.a is in devcpp/lib/.

5. Create an example project

startup DevCpp and go to File->New->Project.

choose Windows Application (stdout targets stdout.txt) or Console Application (stdout targets the console).

after you've created your project go to Project->Project Options (Ctrl+P) and open the Parameters tab.
under Linker add

-lmingw32 -lSDLmain -lSDL

devcpp project options parameter tab
it should look like this

as alternative you can just write

-lSDLmain -lSDL

and put

#ifdef main
#undef main
#endif

before your int main(...);
this will give you a console output window. the first solution works with output to stdout.txt.

now start coding and have fun.

5. That's it

Now enjoy your fresh DevCPP + SDL.

note that sometimes if you change stuff in a header devcpp doesn't recognize that it has to rebuild some sources. use Execute->Rebuild All (Ctrl+F11) in this case.

questions / critics / comments? forum


http://jnrdev.72dpiarmy.com © 2003-2004 Florian Hufsky