Giving Eclipse another shot to see if it could replace Netbeans as my IDE for C++, I wanted to see if I could compile the server for my Gaoth project. Since MinGW already was installed, it found and chose it as the default compiler, which was great. It was, however, when I tried to link in SFML that I got into some trouble as it was very unclear of how it should be done. There were some solutions on the web, though the most promising ones relied on images which were no longer available, so I figured I might as well write about how it should be done.

Download the compiled package for MinGW from the official SFML website and extract it into a folder, and lets for simplicity sake say that the path that folder now is {FOLDER}. The path to the extracted contents will be something like {FOLDER}/SFML-1.6.

In Eclipse, right-click on your project and choose Properties. In the window that opened, go C/C++ Build -> Settings as shown in the picture below.

How to include the SFML header files in Eclipse

In my case, the {FOLDER} path is C:\Users\fuujin\Documents\. So what you have to do is to link to your {FOLDER}/SFML-1.6/include. Now it is time to link to the libraries, which is shown in the picture below.

How to link SFML libraries in Eclipse

Set the search path to your {FOLDER}/SFML-1.6/lib. It is important to note that though the name of e.g. the system packages is libsfml-system.a, you should only write sfml-system. Otherwise you will get an error stating cannot find -llibsfml-system.a, which simply means that it couldn’t find any library file with that name.