Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Project ERROR: Cannot run compiler 'g++'. (Windows, Qt 5.15.2, MinGW 8.1.0 64bit, Qt Creator 6.0.1)
Forum Updated to NodeBB v4.3 + New Features

Project ERROR: Cannot run compiler 'g++'. (Windows, Qt 5.15.2, MinGW 8.1.0 64bit, Qt Creator 6.0.1)

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 3 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nguyenduy4321N Offline
    nguyenduy4321N Offline
    nguyenduy4321
    wrote on last edited by
    #1

    I installed the following (from Qt Online Installer):

    • I don't want to have to recompile Additional Libraries
      add.png

    • I choose Qt 5.15.2 and Qt Creator
      qt.png

    • In Qt 5.15.2, I choose MinGW 64bit (specifically version 8.1.0) because I want to build 64bit application
      qt5.png

    • In Tools, I made sure I ticked the MinGW 64bit toolchain (specifically version 8.1.0)
      dev.png

    After the installation was complete, I opened Qt Creator and noticed that the Kits had automatically set up the correct path. . But when I created a New Project and Build it, this error appeared (I also tried adding in the PATH environment variable and Build the project but still got the error):

    Project ERROR: Cannot run compiler 'g++'. Output:
    ===================
    # 1 "C:/Qt/5.15.2/mingw81_64/mkspecs/features/data/macros.cpp"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "C:/Qt/5.15.2/mingw81_64/mkspecs/features/data/macros.cpp"
    QT_COMPILER_STDCXX = 201402L
    # 26 "C:/Qt/5.15.2/mingw81_64/mkspecs/features/data/macros.cpp"
    QMAKE_GCC_MAJOR_VERSION = 8
    QMAKE_GCC_MINOR_VERSION = 1
    QMAKE_GCC_PATCH_VERSION = 0
    ===================
    Maybe you forgot to setup the environment?
    01:04:04: The process "C:\Qt\5.15.2\mingw81_64\bin\qmake.exe" exited with code 3.
    Error while building/deploying project untitled (kit: Desktop Qt 5.15.2 MinGW 64-bit)
    When executing step "qmake"
    

    I have been agonizing for days about this error. Before that I tried to install MinGW32 with Maintain Qt, I Build the same new project without the above error.

    I also tried replacing 5.15.2 with Qt 6.2.2 with MinGW 64bit (inside the install) but that didn't work, tried the qt-opensource-windows-x86-5.12.12 offline install with MinGW 64bit (inside the install). in the installation) and it doesn't work either)

    I wonder if Qt only supports building 32bit apps with MinGW32? Please don't laugh at this question of mine, I'm just a newbie and want to learn Qt.

    1 Reply Last reply
    0
    • cristian-adamC Online
      cristian-adamC Online
      cristian-adam
      wrote on last edited by
      #2

      Make sure you are using the right mkspec with QMake. On Windows with MinGW 8.1.0 that's win32-g++.

      Have you thought of using CMake instead?

      1 Reply Last reply
      1
      • nguyenduy4321N Offline
        nguyenduy4321N Offline
        nguyenduy4321
        wrote on last edited by nguyenduy4321
        #3

        CMake works right, I want to use qmake and want to know exactly this issue.

        I am sure I use right mkspec

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          Hi, perhaps your PATH is a bit poisonous (for example you could have another g++ on your PC), you could try running Qt Creator with an empty path:
          Open a CMD window, then type

          set path=
          C:\Qt\Tools\QtCreator\bin\qtcreator
          

          then try to build a simple test program with your 5.15.2 MinGW 64-bit..

          nguyenduy4321N 1 Reply Last reply
          1
          • hskoglundH hskoglund

            Hi, perhaps your PATH is a bit poisonous (for example you could have another g++ on your PC), you could try running Qt Creator with an empty path:
            Open a CMD window, then type

            set path=
            C:\Qt\Tools\QtCreator\bin\qtcreator
            

            then try to build a simple test program with your 5.15.2 MinGW 64-bit..

            nguyenduy4321N Offline
            nguyenduy4321N Offline
            nguyenduy4321
            wrote on last edited by
            #5

            @hskoglund I will try all the suggestions from everyone, and your suggestion still doesn't work
            Untitled.png
            You see, it doesn't seem to work even though I do set path=

            1 Reply Last reply
            0
            • nguyenduy4321N Offline
              nguyenduy4321N Offline
              nguyenduy4321
              wrote on last edited by nguyenduy4321
              #6

              LoL, I already solved it.

              And this is how I solved the issue. My PATH is clean and nice, however, my cmd's AutoRun is a mess. I tried deleting everything in AutoRun (HKCU\SOFTWARE\Microsoft\Command Processor\AutoRun or HKLM\SOFTWARE\Microsoft\Command Processor\AutoRun) for testing and Qt was able to build fine.

              My AutoRun is messy because I integrated cmder into cmd but didn't follow the author's guide. I stuffed a long script into AutoRun (without creating a separate 'cmder_shell.bat' file) and it was working fine before I started using Qt. And now I see the above issue I mentioned.

              Hope my stupid experience helps those who face similar issue to have more solutions. For those who use cmder integrated into cmd please follow the author's guide, don't be like me.

              1 Reply Last reply
              2

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved