"Create Precompiled Header"和"Create Precompiled Header"之间有什么区别? (/Yc)和“使用预编译标题"; (/Yu)在Visual Studio中? [英] What is the difference between "Create Precompiled Header" (/Yc) and "Use Precompiled Header" (/Yu) in Visual Studio?
问题描述
我阅读了MSDN中的文档,但最后我不清楚他们之间的实际区别是什么.两者似乎都要求在每个* .cpp文件的顶部都添加stdafx.h.
I read the documentation in MSDN, but in the end I didn't get a clear idea what is the practical difference between them, exactly. Both seem to require stdafx.h to be added at the top of every *.cpp file.
我正在使用VS2008.
I'm using VS2008.
有人可以帮忙清理一下吗?
Can anyone help clear things up?
推荐答案
好吧,我认为您必须首先了解预编译标头的用途.在大型项目中,例如,处理单个客户端扩展所需的所有标头可能需要花费很多时间,因此某些人喜欢将.pch文件及其库一起分发.为了生成.pch文件,请使用/Yc
编译器标志,想要使用您的库的人将设置/Yu
标志.请参见此处和
Well, I think that you must first understand the purpose of precompiled headers. In large projects, it can take ages to process all the headers required by a single client extension for example, so some people prefer to distribute the .pch files along with their libraries. In order to generate the .pch files, you use the /Yc
compiler flag and the person who wants to consume your library will set the /Yu
flag. See here and here for details.
这篇关于"Create Precompiled Header"和"Create Precompiled Header"之间有什么区别? (/Yc)和“使用预编译标题"; (/Yu)在Visual Studio中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!