SFML 3 Project

Setting Up Visual Studio 2026 and SFML 3

SFML — Simple and Fast Multimedia Library — is a C++ library that gives you a window, a hardware-accelerated 2D renderer, audio, and input handling in a clean API. It's the library behind the Beginning C++ Game Programming book, and the setup here is the same process you'll repeat for every project in that book and beyond.

SFML 3 is a significant update over SFML 2. It requires C++17, its event system has been redesigned around std::optional, and the DLLs no longer carry the old version-number suffix in their filenames. If you're coming from SFML 2, the setup steps are almost identical — but there are a few differences to watch for, and this guide covers all of them.

By the end you'll have a Visual Studio project that compiles, links, and opens an SFML window with a green circle on screen. That's your baseline. Every project from here forward copies this setup.

Downloading SFML 3

Go to sfml-dev.org and find the Download section. You want the pre-built Windows binaries for Visual C++ 17 (2022) — 64-bit. The filename will look something like SFML-3.x.x-windows-vc17-64-bit.zip.

Download that zip and extract it somewhere you'll remember. I keep mine at C:\SFML-3. The exact path doesn't matter, but you'll type it into a few property fields shortly, so shorter is better.

Inside the extracted folder you'll find three folders we care about:

Hold on to those three names. They'll come up in every step below.

Creating the Project

Open Visual Studio 2026. Click Create a New Project. In the search box at the top of the dialog, type Empty Project and select the C++ version from the list. Click Next.

Give the project a name — SFMLSetup works for this first one — and choose a folder for it. Leave Place solution and project in the same directory unchecked. Click Create. Visual Studio opens an empty project with nothing in it.

Adding a Source File

In the Solution Explorer on the right, right-click Source Files and choose Add > New Item. Select C++ File (.cpp), name it main.cpp, and click Add. Leave the file blank for now — we'll fill it in once the project is configured.

Configuring the Project Properties

This is the step that catches people out the first time. Visual Studio has no idea where you put SFML — you have to tell it explicitly. Right-click the project name in the Solution Explorer and choose Properties at the bottom of the menu. A large window opens with a category tree down the left side.

Before changing anything, look at the two dropdowns at the very top of the properties window. Set Configuration to All Configurations and Platform to All Platforms. This ensures the first three changes below apply to both Debug and Release builds in one go.

1. Include Directories

In the category tree on the left, expand C/C++ and click General. On the right you'll see a field called Additional Include Directories. Click in that field, then click the small dropdown arrow that appears, and choose Edit…

A small editor pops up. Click the new-line icon at the top and type the path to SFML's include folder:

C:\SFML-3\include

Click OK to close the editor. You'll see the path appear in the field.

2. Library Directories

Still in the category tree, expand Linker and click General. Find the Additional Library Directories field and edit it the same way. Add:

C:\SFML-3\lib

Click OK.

3. C++ Language Standard

SFML 3 requires C++17. Back in the tree, click C/C++ > Language. Find the C++ Language Standard dropdown and set it to ISO C++17 Standard (/std:c++17).

If you skip this step, SFML's new event API (std::optional-based) won't compile.

4. Linker Input — Debug

SFML ships separate library files for Debug and Release builds. The Debug ones have a -d suffix; the Release ones don't. You have to configure them separately.

At the top of the properties window, change Configuration to Debug (leave Platform on All Platforms).

In the tree, go to Linker > Input. Click the Additional Dependencies field and choose Edit…. Add these three entries, one per line, at the top of the list:

sfml-graphics-d.lib
sfml-window-d.lib
sfml-system-d.lib

Click OK.

5. Linker Input — Release

Now change Configuration to Release and repeat the same step with the non-debug names:

sfml-graphics.lib
sfml-window.lib
sfml-system.lib

Click OK, then click OK again to close the properties window entirely.

That's the configuration done. Five changes: include path, library path, language standard, and two sets of linker input. Every SFML project you create from now on will need the same five.

Copying the DLLs

SFML is a dynamic library. At compile time the linker uses the .lib files you just pointed it to. At runtime, Windows looks for the matching .dll files next to your .exe. If they're not there, your program will launch and immediately crash with a "missing DLL" error.

Open File Explorer and navigate to C:\SFML-3\bin. You'll see a set of DLLs: both plain versions (sfml-graphics.dll, sfml-window.dll, sfml-system.dll) and debug versions (sfml-graphics-d.dll, sfml-window-d.dll, sfml-system-d.dll).

For a Debug build, your .exe lives in the project's x64\Debug folder. Copy the three -d.dll files there. If the Debug folder doesn't exist yet, do a first build — it will be created — then paste the DLLs in.

When you eventually build a Release version, do the same thing with the three plain .dll files into x64\Release.

Adding audio or networking? Those modules need their own DLLs: sfml-audio-d.dll / sfml-audio.dll plus openal32.dll for audio, and sfml-network-d.dll / sfml-network.dll for networking. Copy only what you actually use. Add sfml-audio-d.lib / sfml-audio.lib and sfml-network-d.lib / sfml-network.lib to the matching linker input fields when you need them.

Testing the Setup

Open main.cpp and paste in this test program:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode({800u, 600u}), "SFML 3 Works!");

    sf::CircleShape circle(50.f);
    circle.setFillColor(sf::Color::Green);
    circle.setPosition({375.f, 275.f});

    while (window.isOpen())
    {
        while (const auto event = window.pollEvent())
        {
            if (event->is<sf::Event::Closed>())
                window.close();
        }

        window.clear(sf::Color::Black);
        window.draw(circle);
        window.display();
    }

    return 0;
}

Press F5 (or the green Play button). After a moment you should see a black 800×600 window with a green circle sitting in the middle of it. If you see that, the setup is complete — includes found, libraries linked, DLLs in place, and the SFML 3 API working correctly.

A few things in the code worth noting if this is your first SFML 3 program:

Common Issues

Build fails with "cannot open include file: 'SFML/Graphics.hpp'". The include path is wrong or missing. Open Project Properties, go to C/C++ > General > Additional Include Directories, and check the path points to the include folder inside your SFML download — not the SFML root folder and not the SFML subfolder inside include. It should end with \include.

Build fails with "cannot open input file 'sfml-graphics-d.lib'". The library path is wrong or missing. Check Linker > General > Additional Library Directories points to the lib folder, and that the Configuration dropdown was set to Debug (not All Configurations) when you added the -d lib names.

Program crashes immediately with "The code execution cannot proceed because sfml-graphics-d.dll was not found". The DLL hasn't been copied. Find sfml-graphics-d.dll (and sfml-window-d.dll, sfml-system-d.dll) in C:\SFML-3\bin and paste them into your project's x64\Debug folder alongside the .exe.

Compiler errors mentioning std::optional or structured bindings. The C++ standard isn't set to C++17. Open Properties, go to C/C++ > Language > C++ Language Standard, and set it to ISO C++17 Standard (/std:c++17). Make sure Configuration is set to All Configurations so it applies to both Debug and Release.

Linker error LNK2019 — unresolved external symbol. A library file is missing from Additional Dependencies. Double-check that you added all three libs (sfml-graphics, sfml-window, sfml-system) with the correct suffix for the configuration you're building. Debug builds need the -d versions; Release builds need the plain versions.

Where to Go Next