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

After installing Qt 5.12.8 PATH not set?



  • After completing the install of Qt 5.12.8 on Windows, I expected that PATH would have been updated to add Qt related stuff but apparently not - is this something I need to do myself?

    Part of the reason I ask is that I have Anaconda2 installed and that ships a version of qmake (now an out of date one):

    C:\Users\amonra>where qmake.exe
    C:\ANACONDA2\Library\bin\qmake.exe

    C:\Users\amonra>qmake --version
    QMake version 2.01a
    Using Qt version 4.8.7 in C:/Anaconda2/Library/lib

    Or should I always
    use the customised command line short cuts that Qt sets up in the "Start" menu?



  • No, Qt installer will not change your PATH.
    If you want, you can set it yourself.
    Actually, you can install multiple versions of Qt in the same machine.
    If it sets the PATH, then there will be conflicts.
    So, what we usually do is, if need to build from command line, we use that shortcut you mentioned.
    And when building from Qt Creator, there is no need to set PATH after the Kit configuration is completed.



  • OK that's fine. So my follow up question:

    I started a command prompt using the shortcut "Qt 5.12.8 (MSVC 2017 64-bit)" and then change to

    D:\qt-book\chap10\settingsviewer>

    I get:

    D:\qt-book\chap10\settingsviewer>qmake settingsviewer.pro
    Project ERROR: Cannot run compiler 'cl'. Output:

    ===================
    Maybe you forgot to setup the environment?

    Am I required to tailor the command file used for this command prompt to include all the stuff from:

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"

    Or what?

    Thanks
    David



  • @Perdrix When you start the shortcut, I think there would be a notice:

    Setting up environment for Qt usage...
    Remember to call vcvarsall.bat to complete environment setup!
    

    Actually, for MSVC builds, what I usually do is: start the command prompt from VS shortcut, and then add Qt's bin to PATH in it.
    Or just open that project in Qt Creator.



  • Not quite that simple though ...

    As c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build

    Isn't exactly in the path! I had to do hunting for it!

    David



  • @Perdrix Yes, that's why I start from VS shortcut :)
    But if using Qt Creator, it's pretty simple.



  • Well, I modified C:\Qt\5.12.8\msvc2017_64\bin\qtenv2.bat

    @echo off
    echo Setting up environment for Qt usage...
    set PATH=C:\Qt\5.12.8\msvc2017_64\bin;%PATH%
    cd /D C:\Qt\5.12.8\msvc2017_64
    echo Remember to call vcvarsall.bat to complete environment setup!
    @call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
    

    But when I tried to build the project it all fell apart:

    Setting up environment for Qt usage...
    Remember to call vcvarsall.bat to complete environment setup!
    **********************************************************************
    ** Visual Studio 2017 Developer Command Prompt v15.9.14
    ** Copyright (c) 2017 Microsoft Corporation
    **********************************************************************
    [vcvarsall.bat] Environment initialized for: 'x64'
    
    C:\Qt\5.12.8\msvc2017_64>cd d:\qt-book\chap10
    
    C:\Qt\5.12.8\msvc2017_64>d:
    
    d:\qt-book\chap10>cd settingsviewer
    
    d:\qt-book\chap10\settingsviewer>qmake
    Info: creating stash file D:\qt-book\chap10\settingsviewer\.qmake.stash
    
    d:\qt-book\chap10\settingsviewer>make
    'make' is not recognized as an internal or external command,
    operable program or batch file.
    
    d:\qt-book\chap10\settingsviewer>nmake
    
    Microsoft (R) Program Maintenance Utility Version 14.16.27032.1
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe" -f Makefile.Release
    
    Microsoft (R) Program Maintenance Utility Version 14.16.27032.1
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
            cl -BxC:\Qt\5.12.8\msvc2017_64\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E C:\Qt\5.12.8\msvc2017_64\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
            C:\Qt\5.12.8\msvc2017_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG --compiler-flavor=msvc --include D:/qt-book/chap10/settingsviewer/release/moc_predefs.h -IC:/Qt/5.12.8/msvc2017_64/mkspecs/win32-msvc -ID:/qt-book/chap10/settingsviewer -IC:/Qt/5.12.8/msvc2017_64/include -IC:/Qt/5.12.8/msvc2017_64/include/QtGui -IC:/Qt/5.12.8/msvc2017_64/include/QtANGLE -IC:/Qt/5.12.8/msvc2017_64/include/QtCore -I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" -I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" settingsviewer.h -o release\moc_settingsviewer.cpp
            cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I. -IC:\Qt\5.12.8\msvc2017_64\include -IC:\Qt\5.12.8\msvc2017_64\include\QtGui -IC:\Qt\5.12.8\msvc2017_64\include\QtANGLE -IC:\Qt\5.12.8\msvc2017_64\include\QtCore -Irelease -I/include -IC:\Qt\5.12.8\msvc2017_64\mkspecs\win32-msvc -Forelease\ @C:\Users\amonra\AppData\Local\Temp\nm9F60.tmp
    main.cpp
    .\main.cpp(1): fatal error C1083: Cannot open include file: 'QApplication': No such file or directory
    settingsviewer.cpp
    d:\qt-book\chap10\settingsviewer\settingsviewer.h(4): fatal error C1083: Cannot open include file: 'QDialog': No such file or directory
    Generating Code...
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
    Stop.
    
    

    David



  • Well, this is a different issue from the title.
    And I've seen this kind of problems all the time in the forum.
    Maybe you can do some search.


  • Moderators

    @Perdrix Looking at your compiler command line you don't have widgets module added in your .pro file like I told you in the other thread.


Log in to reply