Why do we use `#include 'stdafx.h" instead of `#include <stdafx.h>`?
From here it says:
For #include "filename", the preprocessor searches in the same file as the directive. This method is commonly used to include header files defined by a programmer.
To # enable preprocessor search in an implementation in a dependent manner, usually in search directories previously designated by the compiler / IDE. This method is commonly used to include a standard library of header files.
So far, this wiki link indicates that stdafx.h is a header file pre-engineered by the visual studio IDE
stdafx.h is a file created by the wizards of the Microsoft Visual Studio IDE that describes both standard and project-specific files that are often used but almost never changed.
Compatible compilers (e.g. Visual C ++ 6.0 and newer) will precompile this file to reduce overall compilation time. Visual C ++ will not compile anything before #include "stdafx.h" in the source file if the compilation option / Yu 'stdafx.h' is not checked (by default); it takes all the code in the source before and including the line already compiled.
AFX in stdafx.h stands for Application Framework eXtensions. AFX was the original abbreviation for Microsoft Foundation Classes (MFC). Although the name stdafx.h is used by default, projects can provide an alternate name.
Then
Why do we use #include "stdafx.h" instead of #include <stdafx.h> ?
A stdafx.h , stdafx.cpp pair is generated VS from a template. It is located in the same directory as the other files. You will probably end up changing it for your project. Therefore, we use "" instead of <> for the very reason that it is in the same directory as your first quote.
Because stdafx.h for each project. As you pointed out, #include "" looking for the path to the current project, and stdafx.h is located stdafx.h .
Using #include <stdafx.h> would be a huge mistake , as it should be in the library path (where all the standard library headers are located). This would mean that you should not change it or that it always remains the same, but it never changes for different projects.
So, although it was created by Visual Studio, it is specific to a project, not all projects.