Set compiler flags globally (Zm memory limit)
When compiling some complex templates, I sometimes get:
fatal error C1076: compiler limit: internal heap limit reached; use / Zm to specify a higher limit
I know I can go to the project settings and specify, for example /Zm500
, to give the compiler more memory (more on this /Zm
can be found here ). This is, however, rather cumbersome and I would rather set the default limit globally. Is there a way to do this?
Alternatively, is there a way to specify this particular flag using a pragma or other source file annotation? Thus, it will also carry over across machines with potentially different settings.
I am using Visual Studio 2008, if it also worked in Visual C ++ 6.0 I would not mind.
source to share
I finally found the answer to this question, here . All that is needed is to set an environment variable CL
:
CL = / Zm500
For example, in Control Panel - System - Environment Variables (note that a restart of the IDE is required). And all assemblies will use this parameter unless overridden by command line arguments cl.exe
.
This works for both MSVC 6.0 and Visual Studio 2008.
source to share