Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Globally set compiler flags (/Zm memory limit)

When compiling some complicated templates, I sometimes get:

fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

I know that I can go to project settings and specify e.g. /Zm500 to give the compiler more memory (more info on /Zm can be found here). It is however quite cumbersome and I would prefer setting a default limit globally. Is there any way to do it?

Alternately, is there any way to specify this particular flag using a pragma or other annotation of the source file? That way it would also be portable accross machines with potentially different settings.

I'm using Visual Studio 2008, if it also worked in Visual C++ 6.0, I wouldn't mind.

like image 598
the swine Avatar asked Sep 17 '14 08:09

the swine


1 Answers

I finally found an answer to this, here. All that is needed, is to set the CL environment variable:

CL=/Zm500

For example in Control Panel - System - Environment Variables (note that restart of the IDE is required). And all the builds will then use this setting, unless overridden by cl.exe commandline arguments.

This works for both MSVC 6.0 and Visual Studio 2008.

like image 145
the swine Avatar answered Oct 19 '22 04:10

the swine