Max Max - 1 month ago 16
C++ Question

Using 64 bit compiler in Visual C++ 2015

I have a C++ project with a lot of templates and it fails to compile with

fatal error C1060: compiler is out of heap space
. There's plenty of free RAM. I tried paying with /Zm compiler option, but it didn't help. I can see that Visual Studio uses the 32 bit version of the compiler and I think this is the reason for this error. Is there any way to force Visual Studio to use 64 bit compiler instead?

UPDATE

My question is not a duplicate. I saw the other questions and tried the suggestions. But in my case the compiler takes more than 6 GB of RAM to compile the project. It was the maximal amount of RAM allocated by the 64 bit compiler. I can use the 64 bit compiler when building my project using
msbuild
, but I want to build it from Visual Studio and it's using 32 bit compiler by default. I want to force it to use the 64 bit compiler. By 64 bit compiler I mean the compiler that not only creates a 64 bit applications, but which is a 64 bit application itself.

Max Max
Answer Source

As suggested by Hans Passant in the comments the solution to this problem was to change the Executable Directories with the one's that point to the 64bit binaries. To do this you need to go to C++ project properties -> VC++ Directories -> Executable Directories in Visual Studio and replace the value with $(VC_ExecutablePath_x64_x64);$(WindowsSDK_ExecutablePath_x64);$(VS_ExecutablePat‌​h);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH)

This change makes Visual Studio use 64 bit C++ compiler.