Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiler is out of heap space

I am trying to port a plugin written in C++ which actually does a lot of stuff, so there are lots of classes and ofcourse a lot of code as well!

But when I try to compile the plugin, the compiler throws the following error: fatal error C1060: compiler is out of heap space. If I check my task manager it shows that there is quite some space left on the memory. I even tried restarting.

I tried the usual answers on the internet on memory allocation limit and on stack overflow previously asked questions as well. None of them have seemed to work for me, hence I am here.

A few things that might be important. The plugin is extensively using the following libraries: FreeImage & protobuf-2.4.1 p.s. I compiled the source code using VS2012 compiler. Using a 64-bit machine

the error shows up in the second line of this code:

#if GOOGLE_PROTOBUF_VERSION < 2004000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers.  Please update
#error your headers.
#endif
#if 2004001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers.  Please
#error regenerate this file with a newer version of protoc.
#endif

I am lost, could anyone point me in the right direction? Thanks alot!

like image 378
deathNode Avatar asked Mar 31 '17 12:03

deathNode


2 Answers

I had the same problem with VC++ 2015 latest update (Update 3). Eventually I worked out that turning off pre-compiled headers avoids the problem.

This was a small project so the difference in build time was minor for us. If you have a large project and must use pre-compiled headers maybe you can try removing some of them.

like image 171
Andrew W. Phillips Avatar answered Nov 16 '22 21:11

Andrew W. Phillips


So there were 2 work-arounds for that. Firstly, I could just simply comment out the provided header descriptions, and that seemed to work magically.

Second, since, the first option did not sound very appropriate, I just recompiled the whole library, and it worked. I am guessing, it was a compiler version mismatch or something. But that seems to work fine..

like image 30
deathNode Avatar answered Nov 16 '22 23:11

deathNode