In MFC/C++ taking too much time to build [closed]

2019-09-20 17:58发布

问题:

I am having one big project in which I have kept all Headers in one common header file and where all I needed i included that header file.. by doing like this project is working fine but if I do changes in any header file its taking too much to build so I want to know is there any resolution to reduce the build time?

回答1:

This isn't really specific to MFC, it is a general C++ thing. Basically don't put everything in 1 common header. Make use of forward declarations wherever possible. Use include guard macros in headers unless doing some special preprocessor magic.

Use a precompiled header and only put stuff in there that very rarely changes. Don't let this header get too big though as that can decrease build times.

Reduce the amount of code in headers. In some cases the pimpl idiom can make headers more terse and less prone to change due to 'internal' implementation changes at the cost of run-time efficiency.

http://www.cplusplus.com/forum/articles/10627/



标签: c++ mfc