Visual Studio Express: fatal error c1060, the compiler is out of heap space

做~自己de王妃 提交于 2020-05-09 02:19:30

问题


I'm trying to build a program from its source code with VC 11 and when the compiler is going to finish, it raises the error in title. As I've read here and in other forums, I've alteady tried both to close as many programs as possibile and to enlarge the size of the swap file in Windows...they don't work.

I've read about a parameter called \Zm but I don't understand how to use it.

Can you please help me?


回答1:


Take a look at this documentation which gives possible solutions:

I also had that problem and found the documentation useful. Main points:

  1. If the compiler also issues errors C1076 and C3859, use the /Zm compiler option to lower the memory allocation limit. More heap space is available to your application if you lower the remaining memory allocation.

    If the /Zm option is already set, try removing it. Heap space might be exhausted because the memory allocation limit specified in the option is too high. The compiler uses a default limit if you remove the /Zm option.

  2. If you are compiling on a 64-bit platform, use the 64-bit compiler toolset. For information, see How to: Enable a 64-Bit Visual C++ Toolset on the Command Line.

  3. On 32-bit Windows, try using the /3GB boot.ini switch.

  4. Increase the size of the Windows swap-file.

  5. Close other running programs.

  6. Eliminate unnecessary include files.

  7. Eliminate unnecessary global variables, for example, by allocating memory dynamically instead of declaring a large array.

  8. Eliminate unused declarations.

  9. Split the current file into smaller files.




回答2:


I can't tell much about the /Zm parameter, but I had the same issue (compiler is out of heap space).

What has helped me was the /m:4 (4 for the count of your CPUs) parameter so that you can use multiple CPUs for building.

Hope that helps you as well.

Also, if you are running on x64, be sure that the x64 version of "msbuild.exe" and "cl.exe" is beeing used. I had the issue that even when using e.g. the x64 ms powershell, the compiler would still choose the 32-bit version of msbuild.exe (in task manager "msbuild.exe*32", windows 7)




回答3:


We had similar problem: a relativelly simple program (although, full of templates, using Eigen library) persistently failed to compile on one of the computers. All were using MSVC2013 x64, but only one was unable to compile the program due to C1060 error. We tried different compiler flags, setting/unsetting -Zm, but failed to resolve it without modifying code.

Some pointers were, however, given to us, when we switched from x64/x64 (64bit compiler for 64bit resulting executable) version of the compiler to the x86/x86 (32bit compiler for 32bit resulting executable). The x86 compiler gave us exact locations of the problematic parts of the program - calls to template functions receiving heavy templated objects. We have rewritten those to normal functions (build in different object file) and that solved the problem...




回答4:


In addition to the other answers here (and in my case), fatal error C1060: compiler is out of heap space can be caused by a syntax error. The following code (in certain circumstances) can cause this error even with correct compiler options -- for instance if you've previously successfully compiled the same program.

r.push_back(e[1];

instead of

r.push_back(e[1]);

It seems to only cause this error rather than the standard error C2143: syntax error: missing ')' before ';' when r and e are of certain types, but it's worth checking any code you've edited recently if the program previously compiled without errors.




回答5:


VS: Visual Studio 2015 OS: Windows10

If you are using VS2015 as your IDE, maybe there is another solution: Go to update the VS2015 "Update3" package and everything will work smoothly.



来源:https://stackoverflow.com/questions/23917089/visual-studio-express-fatal-error-c1060-the-compiler-is-out-of-heap-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!