The msvc2017x64 compiler compiles the project and reports an error "the compiler has insufficient heap space" error solution

        When developing daily software, because the project is large and there are many modules, when compiling, the error "the compiler has insufficient compilation space" is reported, and the problem cannot be eliminated by conventional methods. The opengl module takes up a lot of memory


Attempt
Attempt 1
  According to the routine, increase the resource allocation in pro:

CONFIG += resources_big
1
  doesn't solve it.

Attempt 2
  Follow the usual practice to directly modify the compiled compiler:
  
  it cannot be solved.


Solution
  Because the configuration of memory allocation of the compiler was not found (mainly developed using QtCreator), try to increase the memory (because the author developed it as a virtual machine win10+8GB, and expanded it to win10+16GB memory, to solve it). From this, we can guess
  
  , The compiler of msvc2017x64 has a place to configure the ratio of the used memory to the system memory (monitored during the compilation process, the actual used memory is not large), it may be more than the ratio, after increasing the system memory, it will not exceed the limit, Compilation passed normally.

Solution

Because the 64-bit program compiled by this product is also caused by the default use of 32 cl.exe//. . If the memory exceeds 3.5gb, an error will be reported. .
So you need to switch to 64 cl.exe
1: Open the vcxproj file. Add one to the ItemGroup of Globals:
@PreferredToolArchitecture@x64@/PreferredToolArchitecture@ Replace @ with the corresponding <>

2: Open your vs installation directory. For example, my machine C:\Program Files (x86)\Microsoft Visual Studio\Preview\Professional\VC\Tools\MSVC\14.15.26726\bin and swap the folder names of Hostx86 and Hostx64
. . That's what I use. . Simple and fast. .

Guess you like

Origin blog.csdn.net/vcit102/article/details/131803181