Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Missing ingredients and build steps in qmake generated Visual Studio project



  • New user here.

    The qmake-Xcode pipeline works perfectly for me on macOS 10.14 / Xcode 10.3;

    When dev on Windows 10 / VS 2017, however, a few glitches are noticed.

    Glitch 1: Generating VS project

    Running qmake -project fails with complaints about environment setup. This was solved by adding

    call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
    

    to %QT_DIR%\bin\qtenv2.bat by hand.

    Then, I successfully generated a Visual Studio project with:

    qmake -project
    qmake -tp vc myproj.pro
    

    Glitch 2: Building the VS project

    Then when building, I got this: Cannot find #include file for widgets, and solved it by adding QT += widgets to mproj.pro by hand.

    Glitch 3: Running the app

    Upon running, the app crashes upon running complaining about

    could not find or load the Qt platform plugin "windows" in "",
    

    Helped by this post:
    https://forum.qt.io/topic/90293/could-not-find-or-load-the-qt-platform-plugin-windows-in

    I then realized that it's the missing deployment procedure, and added a Post-Build Event to VS.

    echo "Post Build Event"
    windeployqt $(TargetPath)
    

    Then everything works.

    Am I missing anything or are these glitches meant to be fixed by hand on user side?

    I feel that they could be easily fixed in qmake with its generated projects. So that VS users could get a similar smooth experience with the Xcode users.


  • Lifetime Qt Champion

    Hi @kakyoism

    Running qmake -project fails with complaints about environment setup. This was solved by adding

    qmake -project only creates a stub. You have to edit it by hand afterwards to get a functional project file.

    Setting up the environment is nothing anyone else can do for you, don't you agree?

    And deployment is a necessary step on every platform, I agree that this could be a bit more automated (like a make deploy step). But unfortunately we don't have it.

    I feel that they could be easily fixed in qmake with its generated projects.

    As Qt is switching to CMake, qmake will only get fixes from now on. Adding more functionality is quite unlikely.

    Regards


Log in to reply