Search code examples
c++sfmlclion

Exit code -1073741515 on CLion project with SFML


I'm trying to use SFML on Clion (and MinGW as compiler suite): there isn't any problem during the building and linking process, i can also include SFML files whitout problems but when i run the project i get -1073741515 as exit code. At the moment my project is only a main.cpp file that i have copied from the sfml tutorial about managing a window

My cmake.txt

cmake_minimum_required(VERSION 3.6)
project(Survival_2D)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Modules" ${CMAKE_MODULE_PATH})

set(SOURCE_FILES main.cpp)
add_executable(Survival_2D ${SOURCE_FILES})

find_package(SFML REQUIRED system window graphics network audio)

if(SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(Survival_2D ${SFML_LIBRARIES})
endif()

main.cpp

#include <SFML/Window.hpp>

int main() {
    
    sf::Window window(sf::VideoMode(800, 600), "My window");

    while (window.isOpen()) {

        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }
    return 0;
}

Solution

  • Solved by adding sfml-dlls to project folder