(SFML library) RenderWindow constructor throws exception


I am getting started with SFML with Visual Studio 2019. I followed this tuttorial and launched the app successfuly. But without any changes to the code I launched it one more time and it gives me this error:

Exception thrown at 0x53582687 (sfml-system-2.dll) in Voidger.exe: 0xC0000005: Access violation reading location 0x0000016E. occurred

on this line:

RenderWindow window(VideoMode(200, 200), "SFML works!"); //not really

Ever since the app will output the same error and will occasionaly create a window if some magic stars allign. When I discovered the error I tried to create a new project but had issue with linker so abanded it as the other app didn't even start.

Here is the full code (provided on official website):

#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

using namespace sf;

int main()
    std::cout << "H\n";

    RenderWindow window(VideoMode(200, 200), "SFML works!"); // error line
    CircleShape shape(100.f);

    while (window.isOpen())
        Event event;
        while (window.pollEvent(event))
            if (event.type == Event::Closed)


    return 0;

The funniest thing is that the code always launches, outputs the h in cmd and most of times exits with code -1073741819.

Edit: Here is config manager settings that I use.

asked on Stack Overflow Apr 1, 2020 by Maxim Kuzmin • edited Apr 1, 2020 by Maxim Kuzmin

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0