Configure NetBeans / SDL 2.0.3 / MinGW

I will reproduce here the steps to configure SDL2.0.3 library for Netbeans with MinGW in an intel i7 (x86_64 architecture) and Windows 7 64 bit SP1. I will assume you have downloaded already the neccesary packages (netbeans, mingw x86_64 and SDL 2.0.3) and know how to configure environment variables. If you don’t just google “windows 7 set environment variables” and follow instructions; it’s an easy and straightforward process.

  1. Install Netbeans (C/C++ version) from scratch. I installed stable version 7.4
  2. Install MinGW x86_64 version. The path where it was installed will be henceforth called %MINGWPATH%”
  3. Uncompress SDL tar file to %SDLPATH%
  4. Add “%MINGWPATH%/msys/1.0/bin” and “%MINGWPATH%/bin” to the PATH environment variable.
  5. Start netbeans; it should automatically detect your mingw tool collection. If it doesn’t, go to tools -> Options -> c/c++ -> build tools tab and click on add collection. Select the /bin folder of the %MINGWPATH% as the base directory, and %MINGWPATH%/msys/1.0/bin for the make.exe if it’s not automatically selected.
  6. Now create a new project and create a c++ application.
  7. In Project properties -> c++ compiler -> include directories and headers -> add folder %SDLPATH%/x86_64-w64-mingw32/bin
  8. Do not close the window; on the Linker section add %SDLPATH%/x86_64-w64-mingw32/lib to “additional library directories”.
  9. Finally, add these libraries in this order: mingw32.a, SDL2main.a, SDL2.a. The first file can be found on the %MINGWPATH%/x86_64-w64-mingw32/lib and the other two in the %SDLPATH%/x86_64-w64-mingw32/lib.
Now you should be able to succesfully compile an application that can make use of the SDL API. To create SDL applications, google a bit more. 🙂
Configure NetBeans / SDL 2.0.3 / MinGW