Eclipse - SDL (Simple Directmedia Layer) - Installation

You like C and C++ but you need some help to access audio, joystick, keyboard, video framebuffer, etc.
That's why you would like to use the SDL library.

But, there is still a problem, you don't know how to install it with Eclipse.

OK, let's try it with this tutorial installation.

1. Installation of SDL with Eclipse on Windows

A. Outside Eclipse

We assume that you have already installed MinGW in this directory: C:\soft\mingw.

Let's get started by downloading the development libraries of your choice on the official website:

So let's take the SDL-devel-LAST_VERSION-mingw32.tar.gz version.

Open it and extract:

  • bin/SDL.ddl
  • bin/sdl-config

into C:\soft\mingw\bin


  • include/SDL

into C:\soft\mingw\include

And finally:

  • lib/libSDL.dll.a
  • lib/
  • lib/libSDLmain.a

into C:\soft\mingw\lib

So we have now:


B. Inside Eclipse

Open, for example, a C++ project.

Right click its name > Properties (or just use the ALT + ENTER shortcut).
Then C/C++ Build > Settings.

On the right there are multiple tabs.
Select the Tool Settings one.
On the list, click Libraries (sub part of the C++ Linker of your choice, for example MinGW).
On the right, there are two panels: Libraries (-l) and Library search path (-L).

On the first (Libraries), click the + icon to add the following libraries, in the same order or it won't work:

  1. mingw32
  2. SDLmain
  3. SDL

What you are doing there is to add libraries that you have just added before in the MinGW folder.
These libraries can be found in the C:\soft\mingw\lib directory.
They have the .a extension as all libraries in C and C++.

Click Apply and OK to return to your project.

You can now test this setup of SDL on Eclipse with an Hello World tutorial!.