报错如下:
loaded library "/opt/qtcreator-4.8.2/lib/Qt/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display :0.0
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.
原因是:Qt需要显示窗口,但是WSL没有这个功能,需要将MobaXterm这种应用先安装在Windows上。并在MobaXterm中打开Ubuntu,再在Ubuntu中打开Qt。