How to run and debug a GUI application on WSL2?
I've setup VcXsrv client on windows
Added
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
export LIBGL_ALWAYS_INDIRECT=1
into `~/.bashrc` of the WSL Ubuntu distribution
Installed the xubuntu-desktop
If i start an application from Ubuntu shell (which shows up in start menu as Ubuntu) then it launches a GUI app on my host system (Windows)
CLion issues this command `wsl.exe --distribution Ubuntu --exec /bin/bash -c "cd some_path && ./run_some_executable"` and it fails with `qt.qpa.xcb: could not connect to display` (it is a QT application). If i run this command from cmd.exe it shows the same message
UPD
And another question. Is it possible to force CLion to run `wsl.exe --distribution <distro> --exec /bin/bash -ilc <command>` instead of `wsl.exe --distribution <distro> --exec /bin/bash -c <command>`?
Please sign in to leave a comment.
Hello!
Starting with CLion 2021.3 it's possible to force CLion execute commands in login shell - https://youtrack.jetbrains.com/issue/CPP-27045#focus=Comments-27-5346892.0-0.
Wow, that's a cool feature. I'll definitely try it out