We'll also be setting up Insight for debugging, which is a graphical interface for gdb.
First thing is you want to download the MinGW automated installer from
here. Note that this installer won't install gdb or Insight, so grab
insight-6.6-mingw.tar.bz2. You'll need
7-zip to extract that archive, so go ahead and download that too. Run the automated installer, preferably to C:/mingw. As a minimum choose to install the MinGW base tools, g++ and MinGW make. You might have to wait for it to download and install everything. You'll see from the log what files it downloads, which you can keep in mind if you ever decide to do a manual install.
Next download the MSYS base installer, prefereably the current release (ATTOW this is 1.0.10), and install MSYS. Should be a fairly straight forward affair. For the post install, accept and tell it where you installed mingw (eg. c:/mingw), and it should take care of the rest.
Open up MSYS (there should be a shortcut on your desktop) and type cd /mingw; ls. You should be in /mingw and its contents should be on the screen. Good work, now type exit.
Go into the insight archive you downloaded earlier, and extract whats in insight-mingw/ (ie. the bin,include,lib etc... folders) into C:/mingw. Start MSYS again, and type insight. A window titled 'Source Window' should pop-up. Exit.
The OpenGL headers and such have already been downloaded and installed for you by the MinGW installer, so now all you need is to setup SDL and SDL_Image. Go to the SDL website and download the latest mingw32
development library. You might also want the SDL_Image development library, from
here. The VC8 version should still work with mingw, so just grab that one. Note that SDL_Image is necessary if you want to load image formats such as PNG and JPEG.
Now open up the SDL archive you downloaded and extract the bin,include,lib,man and share folders in to C:/mingw. Do the same thing with the lib folder in the SDL_Image archive, but put the include/SDL_Image.h file into C:/mingw/include/SDL/. That should be it.
Compile your SDL/SDL_Image/OpenGL programs with
g++ -g -o programName source.c `sdl-config --cflags --libs` -lSDL_image -lglu32 -lopengl32Note that
-lmingw32 -lSDLmain -lSDL -mwindows can replace
`sdl-config --cflags --libs`. sdl-config is a script which should have come with your SDL development library, and can be found in C:/mingw/bin.
You might also need to copy SDL.dll from C:/mingw/bin/ to the same location as your executable for the application to start. If you are also using SDL_Image, the relevant DLL files can be found in C:/mingw/lib.