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:
So next up I run the offline installer:
And ...
I skip the account login bit and select the following directory to install
I select the following components
And
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:
Next up I load QtCreator and open the clock example:
I click on each kit to activate them. For some reason the build path is red.
And if I attempt to run I get the following error:
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:
!
and
and
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.
-
-
Hi and welcome to devnet,
Might be a silly question but, did you select the MinGW compiler in the installer ?
-
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;
-
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.
-
Hi @z3ld4,
Please remove everything from your
PATH
exceptC:\Windows
andC:\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 :)
-
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.
-
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.
-
@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 frommake
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 thePATH
, 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\binSystem 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\