在MFC / C ++中花费太多的时间来构建 [英] In MFC/C++ taking too much time to build

查看:145
本文介绍了在MFC / C ++中花费太多的时间来构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大项目,我已经保持所有标题在一个共同的头文件,我需要我包括那个头文件..通过做这样的项目是工作正常,但如果我做任何头文件的更改它需要太多的构建,所以我想知道是否有任何解决方案,以减少构建时间?

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?

推荐答案

真的特定于MFC,它是一个通用的C ++东西。基本上不要把一切放在1个公共头。尽可能使用转发声明。除非使用一些特殊的预处理器魔法,否则在头文件中使用包含guard宏。

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.

减少标头中的代码量。在某些情况下,pimpl成语可以使标题更简洁,并且不会由于内部实施更改而以运行时效率为代价更改。

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/

这篇关于在MFC / C ++中花费太多的时间来构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆