Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. fatal error C1060: compiler is out of heap space (again)
Qt 6.11 is out! See what's new in the release blog

fatal error C1060: compiler is out of heap space (again)

Scheduled Pinned Locked Moved Solved General and Desktop
32 Posts 9 Posters 8.7k Views 3 Watching
  • 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #14

    Sorry I meant where cl.exe

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    SprezzaturaS 2 Replies Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      Sorry I meant where cl.exe

      SprezzaturaS Offline
      SprezzaturaS Offline
      Sprezzatura
      wrote on last edited by
      #15

      @Christian-Ehrlicher

      where cl.exe
      INFO: Could not find files for the given pattern(s).
      
      1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Sorry I meant where cl.exe

        SprezzaturaS Offline
        SprezzaturaS Offline
        Sprezzatura
        wrote on last edited by
        #16

        @Christian-Ehrlicher I've found the culprit. If I include the following in the .PRO file:

        QMAKE_CFLAGS += -Zc:__cplusplus
        QMAKE_CFLAGS += -permissive-
        

        It compiles successfully with Qt 5.15
        However, when I include this to the .PRO file:

        QMAKE_CFLAGS += -std:c++17
        QMAKE_CFLAGS += -Zc:__cplusplus
        QMAKE_CFLAGS += -permissive-
        

        even Qt 5.15 fails with the "Out of Heap Space" error.
        If I remove this line and try to compile with Qt 6.9, I get:

        QMAKE_CFLAGS += -std:c++17

        "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler"
        

        Why would this option cause the Out of Heap Space error? Are there other options I need to add?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #17

          You have to call it in the console where you build you Qt... you are using a 32bit compiler.

          λ where cl
          C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe
          

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          SprezzaturaS 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            You have to call it in the console where you build you Qt... you are using a 32bit compiler.

            λ where cl
            C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe
            
            SprezzaturaS Offline
            SprezzaturaS Offline
            Sprezzatura
            wrote on last edited by Sprezzatura
            #18

            @Christian-Ehrlicher
            [1] Here's what is displayed in the Compile Output window when I delete the "-nologo" option:

            Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34810 for x64
            Copyright (C) Microsoft Corporation.  All rights reserved.
            

            Note the "x64".

            [2] My .PRO file contains:

            contains(QT_ARCH, i386) {
                message("32-bit" $$QT_ARCH $$QT_VERSION)
            }
            contains(QT_ARCH, x86_64) {
                message("64-bit" $$QT_ARCH $$QT_VERSION)
            }
            

            This is displayed in the Compile Output window:

            Project MESSAGE: 64-bit x86_64 6.9.0
            

            [3] I tried creating a new Kit and adding a 32-bit compiler. Qt flat out rejected it.

            [4] What does the "λ" lambda mean in your example?
            When you say "the console where you build your Qt", do you mean the Terminal window in Qt Creator?
            When I do that, I get:

            >where cl
            INFO: Could not find files for the given pattern(s).
            

            I'm using Windows.

            Christian EhrlicherC 1 Reply Last reply
            0
            • SprezzaturaS Sprezzatura

              @Christian-Ehrlicher
              [1] Here's what is displayed in the Compile Output window when I delete the "-nologo" option:

              Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34810 for x64
              Copyright (C) Microsoft Corporation.  All rights reserved.
              

              Note the "x64".

              [2] My .PRO file contains:

              contains(QT_ARCH, i386) {
                  message("32-bit" $$QT_ARCH $$QT_VERSION)
              }
              contains(QT_ARCH, x86_64) {
                  message("64-bit" $$QT_ARCH $$QT_VERSION)
              }
              

              This is displayed in the Compile Output window:

              Project MESSAGE: 64-bit x86_64 6.9.0
              

              [3] I tried creating a new Kit and adding a 32-bit compiler. Qt flat out rejected it.

              [4] What does the "λ" lambda mean in your example?
              When you say "the console where you build your Qt", do you mean the Terminal window in Qt Creator?
              When I do that, I get:

              >where cl
              INFO: Could not find files for the given pattern(s).
              

              I'm using Windows.

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #19

              @Sprezzatura said in fatal error C1060: compiler is out of heap space (again):

              where cl
              INFO: Could not find files for the given pattern(s).

              Again: execute this on the command line where you also compiled your Qt. Execatly where you did 'cl -nologo'
              You are using a 32bit compiler which creates 64 bit executables. Or you have very low ram on your system which I doubt.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              SprezzaturaS 2 Replies Last reply
              0
              • hskoglundH Offline
                hskoglundH Offline
                hskoglund
                wrote on last edited by
                #20

                In my VS2002 installation there are 4 different cl.exe versions:
                c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx86\x86\cl.exe
                c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx86\x64\cl.exe
                c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x86\cl.exe
                c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\cl.exe

                Two of them (the ..\Hostx86\x64\cl.exe and the ..\Hostx64\x64\cl.exe will show the same output:
                "Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34810 for x64" and both will compile and build 64 bit ..exe files for Qt6.

                So you have a 50% chance of running the correct compiler, i.e. the cl.exe in the subdirectory ..\Hostx64\x64

                1 Reply Last reply
                3
                • Christian EhrlicherC Christian Ehrlicher

                  @Sprezzatura said in fatal error C1060: compiler is out of heap space (again):

                  where cl
                  INFO: Could not find files for the given pattern(s).

                  Again: execute this on the command line where you also compiled your Qt. Execatly where you did 'cl -nologo'
                  You are using a 32bit compiler which creates 64 bit executables. Or you have very low ram on your system which I doubt.

                  SprezzaturaS Offline
                  SprezzaturaS Offline
                  Sprezzatura
                  wrote on last edited by
                  #21

                  @Christian-Ehrlicher I'm not launching this from the command line. I'm using Qt Creator, which automatically creates a stream of commands, including launching cl.exe, followed by a ton of parameters.
                  The output appears in the "Compile Output" window of the Qt Creator IDE.

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Christian Ehrlicher

                    @Sprezzatura said in fatal error C1060: compiler is out of heap space (again):

                    where cl
                    INFO: Could not find files for the given pattern(s).

                    Again: execute this on the command line where you also compiled your Qt. Execatly where you did 'cl -nologo'
                    You are using a 32bit compiler which creates 64 bit executables. Or you have very low ram on your system which I doubt.

                    SprezzaturaS Offline
                    SprezzaturaS Offline
                    Sprezzatura
                    wrote on last edited by Sprezzatura
                    #22

                    @Christian-Ehrlicher

                    Good news! It's working!

                    The solution was to upgrade from VS 2022 ver. 17.13, to ver. 17.14.
                    I tried getting VS to update itself, but it locked up and wiped itself. I had to download and re-install VS 17.14.

                    Here's the kicker: I got the suggestion from OpenAI/ChatGPT!

                    I'm an AI skeptic, but I have to give credit where it's due.

                    Also, ChatGPT suggested "-bigobj", but that didn't make a difference.

                    A sincere thanks to Christian and hskoglund from a 77-year old, half-blind hack :o)

                    Update 17 Mar 2026: The problem reoccurs every few days. Solution is to kill memory hogs until it works: Firefox, Chrome, Thunderbird, Teams, Adobe, whatever.

                    1 Reply Last reply
                    2
                    • SprezzaturaS Sprezzatura has marked this topic as solved on
                    • S Offline
                      S Offline
                      SimonSchroeder
                      wrote on last edited by
                      #23

                      Just as an aside (since I'm a little late to the party): You should turn on C++17 in the .pro file with the line

                      CONFIG += c++17
                      
                      SprezzaturaS 1 Reply Last reply
                      0
                      • S SimonSchroeder

                        Just as an aside (since I'm a little late to the party): You should turn on C++17 in the .pro file with the line

                        CONFIG += c++17
                        
                        SprezzaturaS Offline
                        SprezzaturaS Offline
                        Sprezzatura
                        wrote on last edited by Sprezzatura
                        #24

                        @SimonSchroeder I do have that included:

                        versionAtLeast(QT_VERSION, 6.0.0) {
                        	CONFIG += c++17	# Fails with Qt 5.13 
                        	QMAKE_CFLAGS += -std:c++17                 # required for Qt 6
                        }
                        
                        1 Reply Last reply
                        0
                        • SprezzaturaS Offline
                          SprezzaturaS Offline
                          Sprezzatura
                          wrote on last edited by
                          #25

                          Interesting update: I got the error again, appearing at random after days of successful compilation.

                          I terminated Firefox, the problem went away!

                          O 1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SimonSchroeder
                            wrote on last edited by
                            #26

                            I occasionally have this problem, too. Here's what I have figured out: The task manager shows memory "in use" and "committed" memory. It's the committed memory that is of importance: Committed memory means that through allocations this amount of memory has been promised to some software, but the corresponding memory pages have not been accessed, yet (which is why memory "in use" can be lower). The reason why this memory is not available is because it was already allocated. This means that committed memory must be available at any time (because it is after allocation the program cannot figure out anymore that it would not have this memory, so it must be there). Once the committed memory is full, nothing works anymore (even when memory "in use" shows that you still have 32 GB left). This is why closing Firefox (which usually uses up a lot of memory) helped. Rebooting your computer also helps.

                            Basically, "memory in use" is a useless metric in Windows 11. The only thing that matters is committed memory. (You can find programs that use a lot of committed memory if you select "Details" on the left pane of the task manager.)

                            BTW, does anybody know something like a little widget for Windows 11 that shows committed memory? I would like to have an eye on this. Otherwise Windows will reboot like every other week or so because it ran out of memory (while memory "in use" still shows 32 GB left).

                            JonBJ 1 Reply Last reply
                            0
                            • S SimonSchroeder

                              I occasionally have this problem, too. Here's what I have figured out: The task manager shows memory "in use" and "committed" memory. It's the committed memory that is of importance: Committed memory means that through allocations this amount of memory has been promised to some software, but the corresponding memory pages have not been accessed, yet (which is why memory "in use" can be lower). The reason why this memory is not available is because it was already allocated. This means that committed memory must be available at any time (because it is after allocation the program cannot figure out anymore that it would not have this memory, so it must be there). Once the committed memory is full, nothing works anymore (even when memory "in use" shows that you still have 32 GB left). This is why closing Firefox (which usually uses up a lot of memory) helped. Rebooting your computer also helps.

                              Basically, "memory in use" is a useless metric in Windows 11. The only thing that matters is committed memory. (You can find programs that use a lot of committed memory if you select "Details" on the left pane of the task manager.)

                              BTW, does anybody know something like a little widget for Windows 11 that shows committed memory? I would like to have an eye on this. Otherwise Windows will reboot like every other week or so because it ran out of memory (while memory "in use" still shows 32 GB left).

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by
                              #27

                              @SimonSchroeder said in fatal error C1060: compiler is out of heap space (again):

                              BTW, does anybody know something like a little widget for Windows 11 that shows committed memory? I would like to have an eye on this.

                              Can't you write this yourself with Qt? :)

                              1 Reply Last reply
                              0
                              • SprezzaturaS Sprezzatura

                                Interesting update: I got the error again, appearing at random after days of successful compilation.

                                I terminated Firefox, the problem went away!

                                O Offline
                                O Offline
                                ollarch
                                wrote on last edited by
                                #28

                                @Sprezzatura I had the same problem. I have 3 simultaneous Visual Studio 2022 instances and Firefox with a lot of processes and huge memory usage. Another way to solve this is to limit the number of processors used to compile the solution as it will use less memory due less parallel compilation : Tools > Options > Project and solutions > Compilation and execution > Max number of parallel compilations ---> set it to a lower value.

                                1 Reply Last reply
                                0
                                • Christian EhrlicherC Christian Ehrlicher

                                  @Sprezzatura said in fatal error C1060: compiler is out of heap space (again):

                                  Any suggestions?

                                  Use a 64bit compiler even when you compile for 32bits.

                                  T Offline
                                  T Offline
                                  Taytoo
                                  wrote on last edited by
                                  #29

                                  @Christian-Ehrlicher said in fatal error C1060: compiler is out of heap space (again):

                                  @Sprezzatura said in fatal error C1060: compiler is out of heap space (again):

                                  Any suggestions?

                                  Use a 64bit compiler even when you compile for 32bits.

                                  I'm running into this error while compiling a large resource file (it has a single large resource). How do I check if my project is using 64-bit compiler on VS2026? fyi, my app is 32-bit

                                  1 Reply Last reply
                                  0
                                  • Kent-DorfmanK Offline
                                    Kent-DorfmanK Offline
                                    Kent-Dorfman
                                    wrote on last edited by
                                    #30

                                    seem like you all are trying to treat the symptom and not the underlying cause. these types of problems are often the result of an #include that is cyclic because it does not have a proper macro guard around it. It is always much more convenient to blame the "out of date" toolchain, when in reality the problems are usually PEBCAK (problem exists between chain and keyboard) ;^)

                                    Anyway, if it were my assignment I'd be looking for programmatic problems instead of toolchain issues.

                                    The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      Taytoo
                                      wrote on last edited by
                                      #31

                                      In my case its a large resource file. I can make it work when I enable Two-Pass in Qt Resource compiler but sometimes it fails with error <resourcefilename> object file not found. So trying to make it work without Two-Pass enabled.

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        Taytoo
                                        wrote on last edited by Taytoo
                                        #32

                                        Figured it out! For visual studio,

                                        Go to Project properties -> Advanced (left menu) -> Preferred Build Tool Architecture. It'll be set to Default, which is x86. Set it to x64
                                        

                                        now no more compiler is out of heap space error. More Info

                                        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