Cross-Compiling Qt Application with WSL and Visual Studio 2019 results in ERROR running qmake

57 Views Asked by At

I want to setup cross compilation to compile c++ programms for both distributions, windows and linux. Therefore, I followed the instruction here: https://www.qt.io/blog/creating-an-embedded-qt-quick-application-in-visual-studio-1/2

-> modified the VS2019 installtion and added "Linux development with C++" and "Desktop development with C++" was already installed.

-> setup a WSL with Ubuntu

-> installed GCC-Compiler and Qt-Tools by executing sudo apt install -y build-essential qtcreator qtbase5-dev qt5-qmake

-> back in VS2019 (with "Qt VS Tools" being installed), I have added the a Qt installtion under Extensions -> Qt Vs Tools -> Qt Versions -> add and make the following selection: Qt installation settings

-> created a plain QtConsoleApplication project and added the Qt_WSL version

-> VS2019 directly shows, that it canno open source file "QtCore/QCoreApplication". So it seems like, there is some linking missing. When trying to build the application to get some more information, the following error with qmake appears (I have manually replaced the username by "User"):

>QtConsoleApplication1.vcxproj : error : ERROR running qmake
>QtConsoleApplication1.vcxproj : error : qmake: (/usr/lib/x86_64-linux-gnu/qt5/bin/qmake)
>QtConsoleApplication1.vcxproj : error : qmake: $PWD=C:\Users\"User"\Documents\QtConsoleApplication1\obj\x64\Debug_WSL\qmake\temp
>QtConsoleApplication1.vcxproj : error : qmake: WARNING: Unable to generate output for: /mnt/c/Users/"User"/Documents/QtConsoleApplication1/obj/x64/Debug_WSL/qmake/temp/Makefile [TEMPLATE vcapp]
>QtConsoleApplication1.vcxproj : error : qmake: QIODevice::write: device not open
>QtConsoleApplication1.vcxproj : error : qmake: Error creating .vcxproj file

The Qt versions installed on the windows host and the WSL slightly differs. On windows system version 5.15.12 is installed, while on the WSL 5.15.3 is used. I will try to get the same version on both systems, but I dont think that this causes the current problem...

At the moment, I do not know, how to continue. I do appreciate any kind of help :) Thanks in advance!

0

There are 0 best solutions below