0

I built an application on WSL using the qmake command. It generates an executable. But when I try running, I get the following error:

Got keys from plugin metadata ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/mnt/c/D-drive/codage-aider/student/joanna/joanna-code/src/assignment_6/Qt-projects/HelloWorldGui/platforms" ...
loaded library "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted

I have WSL 2 and so the graphics should work. Not sure what could be causing this issue. Any ideas on how to fix this?
sunny
  • 157
  • 7
  • WSL2 doesn't include GUI support without additional configuration. For that you would need WSLg, a feature in Windows 11 (or some Windows 10 dev builds). Is that what you meant? – NotTheDr01ds Sep 30 '21 at 15:14
  • @NotTheDr01ds I am on windows 10. So is there some way I could configure the GUI support? Or the alternate option, I think, is to experiment on a Linux virtual machine – sunny Sep 30 '21 at 16:13
  • There are ways to configure GUI support in WSL2. See [this question](https://stackoverflow.com/questions/61860208/wsl-2-run-graphical-linux-desktop-applications-from-windows-10-bash-shell-erro) for multiple options (including one from me). I would personally prefer WSL over a VM for this scenario, but either would be fine. Windows 11 (to be released in a few days) will also have this support "out of the box" if you have a system capable of taking the upgrade. Let me know if you still have questions after reading that thread. Thanks! – NotTheDr01ds Sep 30 '21 at 17:45
  • If you're using Windows 11, I think it's supported by default but I have never tried it. On windows 10 you first need to install an X11 server on your Windows OS and then, your applications have to run on using X11 libraries... I know there's integration for X11 with Qt5, but again, I have no experience on that. – Daniel N. Apr 17 '22 at 04:16

0 Answers0