In this article, we'll cover how to install the Simple and Fast Multimedia Library (SFML) for C++ projects for Windows. If you'd like to SFML for Mac, please see this article instead: How to Install SFML for Mac
Installing SFML
2. Click the download link from the top menu, and then select the latest stable version download for SFML.
4. Once downloaded, unzip the file.
5. Rename the unzipped folder "SFML" and move it to the main C:\ drive folder.
6. Once that’s done, you’ve successfully installed SFML! You should be able to #include any SFML module in your projects now.
Compiling with SFML
When compiling C++ code using SFML, we need to tell the compiler where to find the SFML libraries as well as manually link the library of each module that we need. As we will ultimately need Graphics, Audio, Window, and System, we may as well link them all now by running the command:
- g++ -IC:\SFML\include -c main.cpp -o main.o
This links all of the include files and creates the main.o file. Before running the program, you're going to need to put the executable in a folder with the SFML dynamic libraries (DLLs). So, copy the bin folder from the SFML installation folder to your project folder, and move your executable to inside this bin folder.
Last, we want to link all of the library files and create the executable file. Do so with this command:
- g++ -LC:\SFML\lib -o main.exe main.o -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system
Related Articles
How to Install SFML for Mac
In this article, we'll cover how to install the Simple and Fast Multimedia Library (SFML) for C++ projects for Mac. If you'd like to SFML for Windows, please see this article instead: How to Install SFML for Windows Installing SFML 1. Navigate to the ...
How to Install GameMaker
This article will cover how to install the GameMaker engine. Before installation, you may wish to review GameMaker's system requirements. Downloading and Installing GameMaker 1. Head to the GameMaker download page at https://gamemaker.io/en/download ...
How to Install Defold
This article will cover how to install the game engine Defold. Before installation, you may wish to review Defold's system requirements. Please note as well that for our courses, we advise downloading version 1.81 for optimal compatibility. While you ...
How to Install Python
If you intend to use our Python courses with a code editor like Python's built-in IDLE editor, Visual Studio Code, Anaconda, Spyder, or something else, you will need to first install the Python runtime to your local computer. This short article will ...
How to Install Anaconda
In this article, we'll briefly cover how to install Anaconda for working with specific Python and data science courses. Note: This article assumes you already have Python installed to your machine. If not, you can review our article on the ...