Is there a cleaner way to handle C1076 and C3859 compiler errors?

Today I am adding some library headers to our precomp.h file. Then I tried recompiling into debug and got these two errors (generated from boost):

error C3859: the range of virtual memory for PCH is exceeded; recompile with the command line option '-Zm310' or more

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

So I fixed them by increasing the size of the memory heap. There are no problems.

My question is more about whether this issue hides another issue? Should I end up giving it more memory if I keep adding library headers to precomp.h ? Is this the way programmers deal with this, or will there be a β€œcleaner” way to do this?

Additional Information:

  • Visual studio 2013
  • C ++
+6
source share
2 answers

The / Zm switch does not change anything about how the code is interpreted, so it does not hide problems in the code, except that it requires a lot of memory.

The switch only tells the compiler about the memory costs that it should plan at compile time. In VS 2013, the default precompiled header buffer size is 75 MB , which is a value that a complex project can reasonably exceed. In such situations, you can use / Zm to increase the limit. Alternatively, you could invest significant work in reducing the complexity of your included files .

In most cases, it is much better to use developer time to increase / Zm.

+1
source

Try using the 64-bit platform toolkit in Visual Studio. This resolved the issue for us, and this is one of Microsoft 's recommendations on how to address error C1076. He also mentioned precompiled header compilation issues in a blog post.

To change the platform toolkit, open the .vcxproj project and add <PreferredToolArchitecture>x64</PreferredToolArchitecture> to each group of configuration properties according to fooobar.com/questions/986145 / ... (which is for VS 2017, but applies to 2013 )

0
source

Source: https://habr.com/ru/post/986144/


All Articles