Sunday, July 24, 2022

[SOLVED] Failed to open X11 display - How to execute SFML output on WSL - Load WSL GUI apps

Issue

have any of you tried compile and executing SFML c++ project output on wsl? I tried and got

Failed to open X11 display; make sure the DISPLAY environment variable is set correctly
Aborted

Is it possible at all to execute GUI applications through wsl?

(I've installed ubuntu's for wsl)


Solution

If you went on the same problem

first, you need to install VcXsrv and X11 for executing GUI applications through wsl

then you have to add these 2 to your Linux subsystem environment variables:

export DISPLAY=:0

export LIBGL_ALWAYS_INDIRECT=0



Answered By - Saleh Soleymani
Answer Checked By - David Goodson (WPSolving Volunteer)