简体   繁体   English

VisualStudio 2010-没有更多的自动预编译头文件吗?

[英]VisualStudio 2010 - no more automatic precompiled headers?

There was a compiler option /YX in visualStudio6 to generate automatically precompiled headers. visualStudio6中有一个编译器选项/ YX可以自动生成预编译的头文件。 There was no need for stdafx.h/cpp files, the PCH file was generated automatically from CPP headers with or without the #pragma hdrstop directive. 不需要stdafx.h / cpp文件,无论有没有#pragma hdrstop指令,PCH文件都是从CPP标头自动生成的。

The automatic PCH (/YX) appears to be missing in visual studio 2010. Only /Yc (create) or /Yu (use) available. Visual Studio 2010中似乎缺少自动PCH(/ YX)。仅/ Yc(创建)或/ Yu(使用)可用。

Anybody know a way to get it back ? 有人知道找回它的方法吗?

cheers 干杯

/YX has been deprecated. / YX已被弃用。 You must use /Yc and /Yu instead. 您必须改为使用/ Yc和/ Yu。

Microsoft states : "If you remove /YX from your build configurations and replace it with nothing, it can result in faster builds." Microsoft指出 :“如果从构建配置中删除/ YX并不进行任何替换,则可以加快构建速度。”

Basically no time was being saved because more often than not the /YX was guessing wrong. 基本上没有时间被节省,因为/ YX经常猜错了。 So the added overhead was simply a waste. 因此,增加的开销只是浪费。

This was removed in Visual Studio 2005 . 在Visual Studio 2005中已将其删除 I'll have to dig for the reason but I suspect features like parallel compilation didn't work well with automatic precompiled headers. 我将不得不进行挖掘,但是我怀疑诸如并行编译之类的功能在自动预编译头文件中无法正常工作。

BTW 2010 is an old version of Visual Studio. BTW 2010是Visual Studio的旧版本。 If you want to work with the most compliant (and faster) compiler , you should use Visual Studio 2013. The Professional version is free although it's called "Community" nowadays. 如果要使用最兼容(且速度更快)的编译器,则应使用Visual Studio2013。Professional 版本是免费的,尽管现在称为“ Community”。 It supports C++ and all the features that were part of Professional editionsin previous versions. 它支持C ++以及以前版本中Professional版本的所有功能。

You'll get much faster compiles from parallel compilation support than automatic precompiled headers. 与自动预编译头文件相比,并行编译支持的编译速度要快得多。 The difference in speed, compliance, library support and debugging between 2010 and 2013 is huge. 2010年和2013年之间,速度,法规遵从性,库支持和调试之间的差异很大。

UPDATE UPDATE

I found the announcement and the reason was that there was no improvement by automatic precompiled headers over simply not using them. 我发现了该公告 ,原因是自动预编译头文件与不使用它们相比没有任何改进。 It was faster (and more stable) to create them once with /Yc then reuse them with /Yu 用/ Yc创建一次,然后用/ Yu重用一次,速度更快(更稳定)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM