Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61265

qmake fails to generate a visual studio project

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.9.0, 5.9.1
    • Build tools: qmake
    • None
    • My system is Windows 8.1 x64. There I have VS2008 and VS2015 along with several versions of Qt (4.8.6, 5.7.0 for android, 5.7.1 for windows, 5.8 for android, and 5.9 for MSVC2015 32 bit, MSVC2015 64bit, and MSVC201764bit). 

    Description

      I use this command to generate a visual studio project from a .pro file:

      C:\Qt\5.9.0-win32\5.9\msvc2015\bin\qmake.exe -tp vc myproject.pro

       or this one:

      C:\Qt\5.9.0-win32\5.9\msvc2015\bin\qmake.exe -spec win32-msvc -tp vc myproject.pro

      Both fail equally with the following errors:

      C:/Qt/5.9.0-win32/5.9/msvc2015/mkspecs/features/toolchain.prf:129: Variable QMAKE_CXX.COMPILER_MACROS is not defined.
      Project ERROR: msvc-version.conf loaded but QMAKE_MSC_VER isn't set

       

      In Qt 5.9.1 it works better, but the following issues still persist:

      1) qmake -spec win32-msvc -tp vc test.pro works from the Visual Studio Developer Command Prompt only. When run from the command line it gives this error: 

      "Project ERROR: Cannot run compiler 'cl'. Maybe you forgot to setup the environment?"

      Setting VS environment variables by running vcvarsall.bat may help in this case, but previously it wasn't needed.

       

      2) The generated VS project file is missing Debugging -> Environment setting, hence the project may not work properly. For instance, the attached sample project fails to load the image from the resource file. In Qt Creator the same project works fine. Once the Environment has been set, it works in Visual Studio too. In my case I had to manually set it to "PATH=C:\Qt\5.9.1\5.9.1\msvc2015\bin;$(PATH)".

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              buddenha Oswald Buddenhagen
              mentalmushroom Pugach Yaroslav
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes