My (quite large) C++ project has grown to a point where I get a C1060: compiler is out of heap space
error when trying to compile my project.
I'm compiling on a 64-bit Windows 10 machine, but it seems that Visual Studio is compiling my project with the 32-bit toolset (see screenshot below).
The C1060 help page asks me to use the 64-bit toolset, but the link provided talks about how to enable it when compiling with the command line only.
Is there any way to set project properties or something else in Visual Studio 2017 to tell it to use the 64-bit compiler toolset (which is already installed on my machine)?
From the Visual Studio menu, choose Test, then choose Processor Architecture for AnyCPU projects. Choose x64 to run the tests as a 64-bit process.
From the BUILD menu in Visual Studio, select Configuration Manager. From the Active solution platform drop-down list, select New. The New Solution Platform dialog displays. In the Type or select new platform combination box, select x64.
Visual Studio 2017 version 15.3/std:c++17 enables the set of C++17 features implemented by the compiler.
This is how I made Visual Studio 2017 use the x64 toolset, as per this answer:
Open the .vcxproj file with your favourite text editor, find this line:
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
Then add this immediately after it:
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
That answer was for Visual Studio 2013 but it works for 2017 too.
Additional Note: However, it turns out this didn't actually solve my problem. The 64-bit toolset ate up all the memory on my machine and forced me to need to reboot. When I rolled back the latest changes to the code, it compiles using ~2.8GB for the 32-bit compiler, and compiles using ~4.2GB for the 64-bit compiler (the latest code consumed ~6.4GB before freezing my task manager on my 8GB machine). I'll be looking through the new code and attempting to figure out why so much more memory was needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With