c++visual-c++precompiled-headersstdafx.h

Purpose of stdafx.h


What is the purpose of the file stdafx.h and what is meant by precompiled headers?


Solution

  • stdafx.h is a file, generated by Microsoft Visual Studio IDE wizards, that describes both standard system and project specific include files that are used frequently but hardly ever change. Compatible compilers (for example, Visual C++ 6.0 and newer) will pre-compile this file to reduce overall compile times.

    Visual C++ will not compile anything before the #include "stdafx.h" in the source file, unless the compile option /Yu'stdafx.h' is unchecked (by default); it assumes all code in the source up to and including that line is already compiled.

    http://en.wikipedia.org/wiki/Precompiled_header