Why stdfax.h should be the first include on MFC applications? [duplicate]

It’s only true when using Precompiled Headers (PCH), and the reason why there shouldn’t be anything before the #include "stdafx.h" is :

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

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

Leave a Comment