Precompiled header
In computer programming, a precompiled header (PCH) is a (C or C++) header file that is compiled into an intermediate form that is faster to process for the compiler. Usage of precompiled headers may significantly reduce compilation time, especially when applied to large header files, header files that include many other header files, or header files that are included in many translation units. The ideas of precompiled headers were central to the development of C++ modules.
In computer programming, a precompiled header (PCH) is a (C or C++) header file that is compiled into an intermediate form that is faster to process for the compiler. Usage of precompiled headers may significantly reduce compilation time, especially when applied to large header files, header files that include many other header files, or header files that are included in many translation units. The ideas of precompiled headers were central to the development of C++ modules. //header.hpp ... //source.cpp include "header.hpp" ... When compiling source.cpp for the first time with the precompiled header feature turned on, the compiler will generate a precompiled header, header.pch . The next time, if the timestamp of this header did not change, the compiler can skip the compilation phase relating to header.hpp and instead use header.pch directly.
References
- ^ "Can I use #include "pch.h" instead of #include "stdafx.h" as my precompile header in Visual Studio C++?" . Stack Overflow . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1794956400.0
- ^ "LLVM 2.5 Release Notes" . releases.llvm.org . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1794956400.0
- ^ "pph - GCC Wiki" . gcc.gnu.org . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1794956400.0
- ^ Swart, Bob (2003). Borland C++ Builder 6 Developer's Guide . Sams Publishing. ISBN 9780672324802 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1794956400.0
- ^ a b c The Clang Team (2018). "Pretokenized Headers (PTH)" . Clang 7 documentation . Archived from the original on 2018-03-22 . Retrieved 2018-03-28 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1522191600.0
- ^ a b c The Clang Team (2018). "Precompiled Header and Modules Internals" . Clang 7 documentation . Retrieved 2018-03-28 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1522191600.0
- ^ cppreference.com (2025). "Modules (since C++20)" . Retrieved 2025-02-20 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1740006000.0
- ^ cppreference.com (2025). "C++ Standard Library" . Retrieved 2025-02-20 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1740006000.0
- ^ "Creating Precompiled Header Files" . MSDN . Microsoft. 2015. Archived from the original on 2018-03-28 . Retrieved 2018-03-28 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1522191600.0
- ^ "Two Choices for Precompiling Code" . MSDN . Microsoft. 2015 . Retrieved 2018-03-28 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1522191600.0
- ^ a b c "/Yc (Create Precompiled Header File)" . MSDN . Microsoft. 2015 . Retrieved 2018-03-28 . Wikipedia revision 1308752067, retrieved 2026-11-18 · 1522191600.0
Cite this
"Precompiled header". 1756620838. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1308752067 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy