Important: Please read the Qt Code of Conduct -

Setting up Visual Studio 2019 for creating QT6 projects

  • Greetings.

    I have been using Visual Studio 2019 for well over a year to create my QT 5.xx.xx projects in preference to using QT creator. I have downloaded QT6 and successfully run a few of the QT6 demos to test that all is well in QT creator. However I prefer to use visual studio 19 for all my coding and compiling and have found that the latest version of the QT Visual Studio tools (that looks to be a product of the QT company) seems to not offer a setup template for creating a QT6 project.

    I have attempted to set up a QT6 project using the latest version of QT VS tools, and changed the QTDIR environmental variable to match the path to the QT6 directories as I have done in the past when updating QT to a new version. When I compile a simple QT application template to display a QT window, as I do when setting up a new project, I get an error

    ERROR running qmake.

    I know QT6 is abandoning qmake in favor of cmake, but I would have thought that qmake was only a part of creating and compiling QT code within QT Creator, not visual studio, and thus not used.

    So my question is should I need to wait for a new version of QT VS tools to be released and not use QT VS tools to setup a visual studio QT6 project?

    If so, When can a new version of QT VS tools be expected to be released with QT6 project templates?

    I am about to attempt to manually create a Visual Studio project to utilise QT6 and create a QT6 project template using the demos and some QT5 manually setup projects as a guide. Is there any advice I need to follow or information to do this correctly such as a new particular library that is in some obscure location and not easy to detect as being mandatory for all projects? QT6 is so recent I just cannot find anything to help in this regard.

    Any help would be appreciated.


  • @dominion

    Ok, Failed to manually set up Visual Studio 2019 to use QT6 as expected. Not surprised as I have never been able to do this in the past, And I have little to no knowledge of using Cmake, so no complaints.

    However, I had decided to upgrade Qt 5.15.1 to 5.15.2 and did this without a problem. Once that was done, I uninstalled Qt 5.15.1

    Then I decided to try creating a new QT6 project and try out a few things using QT creator for QT6. Well, blow me down, now nothing works and I get a message



    is not a full path to an existing compiler tool.

    Even the examples now have this error occurring.
    But this is a path name to an old installation that I uninstalled months ago.

    As suggested by the error message displayed, I created a CXX environmental variable with the correct path name to this file in my QT6 installation. The Error still occurred.

    Then, also as suggested I created a "CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler"
    which according to online Cmake documentation is of the form

    set(<variable> <value>... CACHE <type> <docstring> [FORCE])

    so using my total non familiarity with Cmake I entered

    set(CMAKE_CXX_COMPILER P:/Productivity/Programing/QT6/Tools/QtCreator/bin/clang/bin/clang-cl.exe CACHE FILEPATH [FORCE])

    into the CMakeLists.txt file.

    Did not solve the problem. It seems to me that there are still a few problems to be ironed out with setting up QT6 using CMake. I am sure there is some file or variable created during installation that this error originates from, but where is and how to fix it is a mystery to me right now. If anyone can help with where this path name is stored so I can modify it, I would much appreciate it.

    I being a user of QT who does not have a familiarity with dealing with Cmake and does not in any way want to even touch Cmake files, as every attempt in the past has lead to disaster, I hope that QT6 will be more friendly towards Cmake novices in future releases.


Log in to reply