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

Project ERROR: Cannot run compiler 'g++'. Output



  • I'm having a difficult time installing Qt on Windows 10 with MinGW. I've reinstalled about 20 times so far and have read countless posts on this forum but to no avail. The error I'm is Cannot run compiler g++, even though it was installed and QtCreator seemed to auto detect it.

    To make things easier to understand I'm going to reinstall again to show my settings etc during installation.

    So right now I have no Qt installed, and no MinGW. No GCC, or G++. As can be confirmed on the command line:

    0_1564232980551_82fc6565-12b4-4e02-ba9f-7a856149bf54-image.png

    So next up I run the offline installer:

    0_1564233098768_44f4dbf3-1872-4751-bb71-c08317c412c1-image.png

    And ...

    0_1564233122710_7929e600-71f3-4cde-b144-0552ee22f83b-image.png

    I skip the account login bit and select the following directory to install

    0_1564233186468_a364182e-e427-43f2-a507-16d9067958de-image.png

    I select the following components

    0_1564233244223_e968af5f-de9a-4eb2-8ee7-b262c2d81548-image.png

    And

    0_1564233270626_33ee67f4-4d38-49cc-8ce4-cb3f648f7342-image.png

    After that I proceed with the installation. Once complete I add the following paths to my environment PATH variable. (I'm not actually sure if I need both 32bit and 64bit. I assume the compiler needs either depending on whether compiling for 32 or 64 bit).

    • C:\Qt\Qt5.12.4\Tools\mingw730_32\bin

    • C:\Qt\Qt5.12.4\Tools\mingw730_64\bin

    When I open the terminal they're loading correctly:

    0_1564238818480_ae201799-2ecb-4f86-b630-5001f0f04cfd-image.png

    Next up I load QtCreator and open the clock example:

    0_1564238893967_0015fc84-f1da-4134-8c2b-0c91103603e7-image.png

    I click on each kit to activate them. For some reason the build path is red.

    0_1564238997758_ca2eda6f-a32c-4fe7-ad58-b9075312f3ab-image.png

    And if I attempt to run I get the following error:

    0_1564239032506_4ccf2399-88df-4738-868b-29ac3b0bc5bb-image.png

    The detailed error is:

    15:50:07: Running steps for project analogclock...
    15:50:07: Starting: "C:\Qt\Qt5.12.4\5.12.4\mingw73_32\bin\qmake.exe" C:\Qt\Qt5.12.4\Examples\Qt-5.12.4\gui\analogclock\analogclock.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
    'C:\Users\KraftWurk\shell.bat' is not recognized as an internal or external command,
    operable program or batch file.
    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    # 1 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    QT_COMPILER_STDCXX = 201402L
    # 26 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    QMAKE_GCC_MAJOR_VERSION = 7
    QMAKE_GCC_MINOR_VERSION = 3
    QMAKE_GCC_PATCH_VERSION = 0
    ===================
    Maybe you forgot to setup the environment?
    15:50:07: The process "C:\Qt\Qt5.12.4\5.12.4\mingw73_32\bin\qmake.exe" exited with code 3.
    Error while building/deploying project analogclock (kit: Desktop Qt 5.12.4 MinGW 32-bit)
    When executing step "qmake"
    15:50:07: Elapsed time: 00:00.
    

    The kit looks to be fine:

    0_1564239326873_2f44d343-fae5-4c1b-9dc5-eb6522940901-image.png !

    and

    0_1564239256322_9930599f-f54d-4e66-8160-eb3097f05d19-image.png

    and

    0_1564239282425_db04edb6-e636-44c1-9342-2f31d3ba8cd5-image.png

    Can anyone help me figure out what's going on? I've tried for weeks to get this working before asking for help. I just can't seem to get it to run correctly.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Might be a silly question but, did you select the MinGW compiler in the installer ?



  • I did yes. There's 2 images above that show MinGW selected. I still haven't managed to find a solution.


  • Lifetime Qt Champion

    @z3ld4 I strongly suspect your PATH contains some incompatible entries - please show its contents.

    Also, I'd start with install only the 32bit Qt and MinGW version.

    Regards



  • echo %PATH% yields:

    C:\Program Files\Microsoft HPC Pack 2012\Bin\;C:\Python37\Scripts\;C:\Python37\;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\HashiCorp\Vagrant\bin;C:\Users\KraftWurk\drivers\chromedriver.exe;C:\Program Files\nodejs\;C:\tools\php73;C:\Qt\Qt5.12.4\Tools\mingw730_32\bin;C:\Qt\Qt5.12.4\Tools\mingw730_64\bin;C:\Users\KraftWurk\AppData\Roaming\Python\Python37\Scripts;C:\Users\KraftWurk\AppData\Local\Microsoft\WindowsApps;C:\Program Files\qemu;C:\Users\KraftWurk\AppData\Local\Programs\radare2;D:\win-bin\hugo;C:\Users\KraftWurk\AppData\Roaming\Composer\vendor\bin;C:\Program Files\7-Zip;C:\Program Files\ngrok;D:\masm32\bin;C:\php;C:\Users\KraftWurk\drivers\chromedriver.exe;C:\masm32\bin;C:\Users\KraftWurk\AppData\Roaming\npm;C:\Program Files (x86)\Dr. Memory\bin\;C:\Windows\System32;C:\tools\neovim\Neovim\bin;C:\lcc\bin;
    

  • Lifetime Qt Champion

    You have both the 32 and 64 bit folders of MinGW in your PATH. Remove them both. Qt Creator will do the adjustment needed when using the selected kit.


  • Lifetime Qt Champion

    Hi @z3ld4,

    Please remove everything from your PATH except C:\Windows and C:\Windows\System32. It should be sufficent to do this in Qt Creators Build Environment for test purpose (in Projects mode, shortcut Ctrl+5).

    It is especially not needed to put the MinGW compilers in the PATH to use them from Creator. But your problem seems to be some other, incompatible shell (or make command), as

    'C:\Users\KraftWurk\shell.bat' is not recognized as an internal or external command,
    operable program or batch file.

    suggests.

    By the way, the red build path just means the directory does not exist yet, that's no problem.

    And everything else looks indeed correct.

    Crossing fingers for you :)



  • I've removed the entries from the path and still getting the same result.

    I'm not sure what is trying to call shell.bat. Is that a MinGW thing?


  • Lifetime Qt Champion

    @z3ld4

    I'm not sure what is trying to call shell.bat. Is that a MinGW thing?

    That's what I'm trying to find out.

    1. Do you have such a file in C:\Users\KraftWurk?
    2. Can you show the generated Makefile(s)?

    Regards



  • @aha_1980 No such file. Are there any tools that I can look to see what's making that call to the bat file? I got sysinternals tools installed.

    Sorry for the basic question, where can I find the generated make file?



  • Is this error related? I've just spotted this one:

    C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/toolchain.prf(76): Variable QMAKE_CXX.COMPILER_MACROS is not defined.
    Project ERROR: failed to parse default search paths from compiler output
    Error while parsing file C:\Qt\Qt5.12.4\Examples\Qt-5.12.4\gui\analogclock\analogclock.pro. Giving up.
    


  • Still baffled by this. Tempted to do a fresh Windows install but it's going to take so much time. I also don't understand why also getting errors in editor.

    0_1564267297055_e6daee30-bf1a-4678-85f6-002f187b8540-image.png



  • Going to try install the previous version (5,12) and see if I get the same error.



  • Same error. Full results:

    Running Windows Runtime device detection.
    No winrtrunner.exe found.
    Running Windows Runtime device detection.
    No winrtrunner.exe found.
    Running Windows Runtime device detection.
    No winrtrunner.exe found.
    'C:\Users\KraftWurk\shell.bat' is not recognized as an internal or external command,
    operable program or batch file.
    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    # 1 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    QT_COMPILER_STDCXX = 201402L
    # 26 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    QMAKE_GCC_MAJOR_VERSION = 7
    QMAKE_GCC_MINOR_VERSION = 3
    QMAKE_GCC_PATCH_VERSION = 0
    ===================
    Maybe you forgot to setup the environment?
    Error while parsing file C:\Qt\Qt5.12.4\Examples\Qt-5.12.4\gui\analogclock\analogclock.pro. Giving up.
    'C:\Users\KraftWurk\shell.bat' is not recognized as an internal or external command,
    operable program or batch file.
    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    # 1 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    QT_COMPILER_STDCXX = 201402L
    # 26 "C:/Qt/Qt5.12.4/5.12.4/mingw73_32/mkspecs/features/data/macros.cpp"
    QMAKE_GCC_MAJOR_VERSION = 7
    QMAKE_GCC_MINOR_VERSION = 3
    QMAKE_GCC_PATCH_VERSION = 0
    ===================
    Maybe you forgot to setup the environment?
    Error while parsing file C:\Qt\Qt5.12.4\Examples\Qt-5.12.4\gui\analogclock\analogclock.pro. Giving up.
    

  • Lifetime Qt Champion

    @z3ld4 said in Project ERROR: Cannot run compiler 'g++'. Output:

    Running Windows Runtime device detection.
    No winrtrunner.exe found.

    But that's something new. You now seem to somewhere have a WinRT alias UWP kit selected.

    As I said before: I'd start with installing exactly ONE Qt MinGW version (I recommend 32 bit) and ONE MinGW compiler. Nothing else.

    Then make sure you eleminate everything unneeded from the PATH variable before starting Creator.

    Then create a new example (make sure nothing is left from previous attempts, especially no .pro.user and Makefiles).

    Then qmake will generate Makefiles in the build folder, which in turn are used from make to generate your program. make will call the compilers to compile and the linker to finally link your program. If any of these calls pick the wrong program from the PATH, it will fail.

    We already know that something at this point went wrong, so if it still goes wrong we need to analyze the Makefiles. But I think that really has to do with some other program in your PATH.

    Regards



  • I had exactly the same problem with 5.13.1. Everything was set like on the screenshots above.
    I also got the same errors when I tried 5.12.4.
    After installing 5.13.1 again, nothing has changed. Still the same errors.

    A few days later, I noticed that I haven´t updated Windows 10 (x64) to 1903. I was still on 1809.
    After the Windows update, QT has worked properly! I did not changed anything in the QT settings or the PATH variables.
    I don´t know, if the windows path variables have caused the problem as only windows specific paths have been added after the update, but it´s worth a try:

    System Path variables before update:
    C:\Program Files\CMake\bin
    C:\Qt\Qt5.13.1\Tools\mingw730_32\bin

    System Path variables after update:
    C:\Program Files\CMake\bin
    C:\Qt\Qt5.13.1\Tools\mingw730_32\bin
    %SystemRoot%\system32
    %SystemRoot%
    %SystemRoot%\System32\Wbem
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0
    %SYSTEMROOT%\System32\OpenSSH\


Log in to reply