VS2019 fatal error C1083: Cannot open compiler intermediate file: xxxx.ipdb: Not enough space

Viewed 1757

I'm using VS2019 to build 32-bit release.

1>------ Build started: Project: modulesLib, Configuration: Release Win32 ------
1>   Creating library ..\..\GeneratedFiles\Release32\\modulesLib.lib and object ..\..\GeneratedFiles\Release32\\modulesLib.exp
1>Generating code
1>Previous IOBJ not found, fall back to full compilation.
1>\modules\stdafx.h.cpp : fatal error C1083: Cannot open compiler intermediate file: '..\..\GeneratedFiles\Release32\\modulesLib.ipdb': Not enough space
1>LINK : fatal error LNK1257: code generation failed
1>Done building project "modulesLib.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 8 up-to-date, 0 skipped ==========

I already found that removing /GL option temporary solved it but this is not the solution.

I have a lot of free space on system drive as same as drive where compilation occurs. I have 32GB RAM, 64-bit Win10.

Is there any solution? Thanks

Edit: Based on the next observations although C1083 is compiler error the reason is that 32-bit linker is running out of memory (reaches 3GB and than process crashed). I believe I saw somewhere that it's possible to use 64-bit toolset to generate 32-bit apps. But I can't find it now.

1 Answers

Ok, I just solved it.

It's a caused by 32-bit linker (although Cxxx error is compiler error).

I obviously reached 3GB limit for /GL (Whole Program Optimization) switch.

The solution is to tell VS to use 64-bit tools to compile 32-bit app via "Prefered build Tool Architecture" set to 64-bit

enter image description here

The same option can also be set via command line (for MSBuild) or via editing vcxproj: https://docs.microsoft.com/en-us/cpp/build/walkthrough-using-msbuild-to-create-a-visual-cpp-project?view=vs-2019#using-msbuild-with-the-64-bit-compiler-and-tools

Related