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
Short summary of how to use PCH files in Visual Studio:
stdafx.h
(you can change this to something else if you wish)Properties -> C++ -> Precompiled Headers
set 'Create/Use precompiled headers' to 'Use'. Hit Applystdafx.cpp
in solution explorer and set the value to 'Create'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.