I'm making a 2D game for a university project, I'm not going to get into the details of the game as I don't believe there is any issue with it. However, when I compile and run the basic example after setting up the environment, I get a segmentation fault for some reason when I close the window using the "X" button.
I've used Valgrind to try to identify the issue, but it gave me 1000+ errors with no clear indication of what is causing that fault. I've also used GDB, but I failed once again. I've also uninstalled and installed the SFML, including the compiler but with no luck.
I'm using SFML on WSL Ubuntu. I'm unsure if this fault is being caused because I'm using WSL but I don't see why this would be a problem. My actual game is working with no issues or crashes.
I ended up stripping every line of code and only keeping what is below, and this is still giving me segmentation fault:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
return 0;
}
This is the output that I've got from the GDB:
(gdb) file main
Reading symbols from main...
(gdb) run
Starting program: <REST OF PATH>/main
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 10702]
[New Thread 0x7fffec50e700 (LWP 10704)]
[New Thread 0x7fffeb78e700 (LWP 10705)]
[New Thread 0x7fffeaf8d700 (LWP 10706)]
[New Thread 0x7fffea78c700 (LWP 10707)]
[New Thread 0x7fffe9f8b700 (LWP 10708)]
Setting vertical sync not supported
Thread 2 "main" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffec50e700 (LWP 10704)]
0x00007fffee1fb8fa in ?? ()
from /usr/lib/wsl/drivers/nvmsoig.inf_amd64_8df9dc2e29a78cea/libnvwgf2umx.so
(gdb) bt
#0 0x00007fffee1fb8fa in ?? ()
from /usr/lib/wsl/drivers/nvmsoig.inf_amd64_8df9dc2e29a78cea/libnvwgf2umx.so
#1 0x00007fffee1f9e9c in ?? ()
from /usr/lib/wsl/drivers/nvmsoig.inf_amd64_8df9dc2e29a78cea/libnvwgf2umx.so
#2 0x00007fffee1f9e26 in ?? ()
from /usr/lib/wsl/drivers/nvmsoig.inf_amd64_8df9dc2e29a78cea/libnvwgf2umx.so
#3 0x00007ffff7708609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#4 0x00007ffff7c53133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
This is the link to the tutorial setup just to be clear what the basic example I'm talking about:
https://www.sfml-dev.org/tutorials/2.5/start-linux.php