+ 4

Compiling code using custom Precompiled Headers

I am trying to reduce the compilation time of my c++ codes that use a custom header that includes around 10 headers (vector, regex, windows.h, and some other custom ones). I am using MinGW 5.0.4, with GCC v8.1. The custom header has a good amount of declarations and inclusions of some other headers that are not precompiled. This leads to a 5-6 second increase in compilation time, even for codes as short as : #include "My_Custom_Header.h" int main() { } Now, I tried searching on the net for solutions and found that one can precompile headers using g++ and then these extra compilations will not take place (useful for cases where the header does not change at all, otherwise I would require a makefile). When I compiled the header, a 184MB .gch file was generated, which is the result of compiling the header. But now, whenever I compile the c++ source, I get an error : "cc1plus.exe has stopped working" I found this link which indicates that this error is due to the extremely large .gch file: https://stackoverflow.com/questions/10841306/cc1plus-exe-crash-when-using-large-precompiled-header-file I tried to solve the issue using OllyDbg as indicated, but it fails to load the cc1plus.exe. Is there another software I can use instead of OllyDbg? How can I remove the error? If this issue is unresolvable, is there another way to reduce the compilation time?

1st Sep 2018, 1:09 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
2 Answers
+ 1
Muhamad Fathi Zuhaili These days, the compiler decides whether something should be inline or not. Simply using the keyword won't help. Also, how will it speed up compilation? The amount of code remains the same, or even increases! I want a way to ensure that the header is not compiled again and again, and all that is compiled is the source code.
2nd Sep 2018, 2:08 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
0
try use inline you have to Google how to use inline
1st Sep 2018, 11:56 PM
Muhamad Fathi Zuhaili
Muhamad Fathi Zuhaili - avatar