Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 749
Max Avatar asked Apr 25 '16 16:04

Max


1 Answers

Referring to https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx?f=255&mspperror=-2147217396#Anchor_1, compiler which is x64 64-bit native can be used.

To do so, as mentioned on https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx#Anchor_0, run vcvarsall amd64 on command prompt.

Then, when running devenv on command line, add the /useenv option :

If you are using DEVENV for command-line builds, the environment set by vcvarsall.bat or vcvars32.bat does not affect your builds, unless you also specify the /useenv option.

like image 189
Brice Avatar answered Oct 02 '22 14:10

Brice