<i id='a0mks'><tr id='a0mks'><dt id='a0mks'><q id='a0mks'><span id='a0mks'><b id='a0mks'><form id='a0mks'><ins id='a0mks'></ins><ul id='a0mks'></ul><sub id='a0mks'></sub></form><legend id='a0mks'></legend><bdo id='a0mks'><pre id='a0mks'><center id='a0mks'></center></pre></bdo></b><th id='a0mks'></th></span></q></dt></tr></i><div id='a0mks'><tfoot id='a0mks'></tfoot><dl id='a0mks'><fieldset id='a0mks'></fieldset></dl></div>
      <bdo id='a0mks'></bdo><ul id='a0mks'></ul>

    1. <legend id='a0mks'><style id='a0mks'><dir id='a0mks'><q id='a0mks'></q></dir></style></legend>

    2. <tfoot id='a0mks'></tfoot>

      <small id='a0mks'></small><noframes id='a0mks'>

    3. 在预编译头文件中放什么?(MSVC)

      时间:2023-07-01
        <tfoot id='hZDuO'></tfoot>

        <small id='hZDuO'></small><noframes id='hZDuO'>

        • <legend id='hZDuO'><style id='hZDuO'><dir id='hZDuO'><q id='hZDuO'></q></dir></style></legend>
        • <i id='hZDuO'><tr id='hZDuO'><dt id='hZDuO'><q id='hZDuO'><span id='hZDuO'><b id='hZDuO'><form id='hZDuO'><ins id='hZDuO'></ins><ul id='hZDuO'></ul><sub id='hZDuO'></sub></form><legend id='hZDuO'></legend><bdo id='hZDuO'><pre id='hZDuO'><center id='hZDuO'></center></pre></bdo></b><th id='hZDuO'></th></span></q></dt></tr></i><div id='hZDuO'><tfoot id='hZDuO'></tfoot><dl id='hZDuO'><fieldset id='hZDuO'></fieldset></dl></div>

            • <bdo id='hZDuO'></bdo><ul id='hZDuO'></ul>
                <tbody id='hZDuO'></tbody>

                本文介绍了在预编译头文件中放什么?(MSVC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                预编译头文件的最佳候选者是什么?我可以将 STL 和 Boost 标头放在那里吗,即使它们有模板?这会减少编译时间吗?另外,减少编译时间的最佳 IDE 设置是什么?

                What are the best candidates for a precompiled header file? Can I put STL and Boost headers there, even though they have templates? And will that reduce compile times? Also, what are the best IDE settings to reduce compile times?

                推荐答案

                快速回答:STL 和 Boost 头文件确实属于预编译头文件,即使这些头文件定义了模板类.

                The quick answer: the STL and Boost headers do indeed belong in the precompiled header file, even though these header files define template classes.

                在生成预编译头文件时,编译器会解析头文本(一项重要任务!),并将其转换为针对编译器进行优化的二进制格式.

                When generating a precompiled header file, a compiler parses the header text (a significant task!), and converts it into a binary format that is optimised for the compiler's benefit.

                即使在编译其他 .cpp 文件时会实例化模板类,它们也会根据预编译头文件中的信息进行实例化,这对于编译器来说读取速度要快得多.

                Even though the template classes will be instantiated when other .cpp files are compiled, they will be instantiated from information in the precompiled header, which is significantly faster for the compiler to read.


                (后来添加)

                您应该在预编译头文件中包含的一件事是作为您项目的一部分并且经常更改的文件,即使每个单独的 .CPP 文件都包含这些文件.

                One thing that you should not include in a precompiled header are files that are part of your project and are changed frequently, even if every single .CPP file includes these files.

                原因是这样 - 预编译头的生成可能需要很长时间,因为 boost、stl 和 windows 库非常大.

                The reason is this - the generation of the precompiled header can take a long time, because the boost, stl and windows libraries are very large.

                您可能有一个所有东西都使用的简单文件(例如StringDefs.h").如果 StringDefs.h 包含在 stdafx.h 中,并且一个开发人员接触了 StringDefs.h,那么每个开发人员都必须等到 整个预编译头重新编译.如果将 StringDefs.h 排除在预编译头之外,并与每个 .CPP 文件一起解析,速度会快得多.

                You might have a simple file (eg "StringDefs.h") that everything uses. If StringDefs.h is included in stdafx.h, and one developer touches StringDefs.h, then every developer has to wait until the entire precompiled header recompiles. It would be much faster if StringDefs.h was left out of the precompiled header, and parsed along with each .CPP file.

                这篇关于在预编译头文件中放什么?(MSVC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Visual Studio 2015 中的编译器是什么 下一篇:如何在非 MFC 项目中使用 TRACE 宏?

                相关文章

                  <legend id='1vDa6'><style id='1vDa6'><dir id='1vDa6'><q id='1vDa6'></q></dir></style></legend>

                  • <bdo id='1vDa6'></bdo><ul id='1vDa6'></ul>

                  1. <i id='1vDa6'><tr id='1vDa6'><dt id='1vDa6'><q id='1vDa6'><span id='1vDa6'><b id='1vDa6'><form id='1vDa6'><ins id='1vDa6'></ins><ul id='1vDa6'></ul><sub id='1vDa6'></sub></form><legend id='1vDa6'></legend><bdo id='1vDa6'><pre id='1vDa6'><center id='1vDa6'></center></pre></bdo></b><th id='1vDa6'></th></span></q></dt></tr></i><div id='1vDa6'><tfoot id='1vDa6'></tfoot><dl id='1vDa6'><fieldset id='1vDa6'></fieldset></dl></div>
                  2. <small id='1vDa6'></small><noframes id='1vDa6'>

                    <tfoot id='1vDa6'></tfoot>