链接时间码生成和预编译头 [英] Link Time Code Generation and Precompiled Headers

查看:72
本文介绍了链接时间码生成和预编译头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接时间代码生成可以重用以前版本中的编译代码来加速编译。使用LTCG时仍然有使用预编译头的好处,还是更好地简化和停止使用PCH?

解决方案

在我看来预编译头(PCH)用于在执行链接阶段和应用链接时代码生成之前将源代码编译为.obj文件。因此,我认为从PCH中受益是有道理的。您可能知道,正确使用PCH
总是将 #include< ...> 语句(包括不可修改的系统头文件)放入(或复制)到stdafx.h文件中。


Link Time Code Generation can reuse compiled code from previous builds to speed up compilation. Is there still a benefit of using Precompiled Headers when using LTCG, or is it better to simplify things and stop using PCH?

解决方案

In my opinion Precompiled Headers (PCH) are used to compile sources into .obj files, before performing the linking stage and applying Link-time Code Generation. Therefore I think it has sense to benefit from PCH. As you probably know, to use PCH correctly always put (or duplicate) the #include <…> statements (that includes unmodifiable system headers) into stdafx.h file.


这篇关于链接时间码生成和预编译头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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