How to use stdafx.h properly?

前端 未结 5 569
借酒劲吻你
借酒劲吻你 2020-12-31 06:56

What is the proper way to use stdafx.h, in terms of separating dependencies?

If I put everything in there, then my compiles ar

5条回答
  •  Happy的楠姐
    2020-12-31 07:17

    Personally, I would rather have slower compilation than no idea (visibility) how dependencies are. However, there are limits to everything.

    As each project has its own pre-compiled header file, so I'd just put common-to-all-includes in there. Say if a project uses some boost headers those would fit well there as they will be used by the whole project and you're not changing them. Hence, put rarely/never changing headers in pre-compiled headers such as system or third party stuff.

    For compilation speed, I'd rather rely on as much as possible to forward-declare things, split into smaller libraries and try to see if things can be organized in a way where volatile code is not affecting recompilation of much other code.

提交回复
热议问题