#SFML not working in CLion

2 messages · Page 1 of 1 (latest)

tender solar
#

So, I installed SFML using the mingw-x64-dynamic thing because I am trying to learn C++ and it only kind of works. CLion allows me to build it and run it with no errors, but when I run it in CLion it doesnt do anything at all and just prints out:

C:\Users\vjste\OneDrive\Desktop\C_Learning\CPP\cmake-build-debug\CPP.exe

Process finished with exit code -1073741511 (0xC0000139)

But when I run the actual file (C:\Users\vjste\OneDrive\Desktop\C_Learning\CPP\cmake-build-debug\CPP.exe) it runs perfectly fine and shows the window and everything.
This is a big problem for me because I want to be able to run my projects using just CLion and not having to build it then open explorer and then run the exe every single time since that is annoying.

Here is literally everything I have checked so far:

  • In C:\Users\vjste\OneDrive\Desktop\C_Learning\CPP\cmake-build-debug the SFML DLLs do exist: sfml-graphics-3, sfml-system-3, sfml-window-3, etc..

  • My CMakeListTexts.txt say the following:

cmake_minimum_required(VERSION 3.20)

project(CPP)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

find_package(SFML COMPONENTS Graphics Window System REQUIRED)

add_executable(CPP main.cpp)

target_link_libraries(CPP PRIVATE
        SFML::Graphics
        SFML::Window
        SFML::System
)
  • My CMake options are:
-DCMAKE_TOOLCHAIN_FILE=C:/WINDOWS/vcpkg/scripts/buildsystems/vcpkg.cmake 
-DVCPKG_TARGET_TRIPLET=x64-mingw-dynamic 
-DVCPKG_APPLOCAL_DEPS=ON 
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=C:/Users/vjste/C_Learning/CPP/cmake-build-debug
  • My environment variables are: PATH=C:\Program Files\JetBrains\CLion 2026.1.1\bin\mingw\bin and inside of there the following DLLs do exist inside of that folder:
libstdc++-6.dll
libgcc_s_seh-1.dll
libwinpthread-1.dll

I'm not exactly sure why all of these settings matter and what they do. These are just things the internet told me to do that didnt work, but if someone could actually see all this and know what I could do to fix things then that would be very nice.
Also, just to clarify, using regular C++ stuff does work. It just starts acting weird when I use the SFML stuff.

#

wait i just realized i should have probably sent all this in a sfml server not a c++ server