In the use of VC programming, in order to speed up the compilation, the VC compiler provides precompiled functionality. That is to include stdafx.h in the CPP code, you can use it to precompile.
the following are as follows:
Copy Code code as follows:
#include "stdafx.h"
Class Demo
{
Public
Demo (void);
~demo (void);
};
Note: #include "stdafx.h" is manually written by itself, the default is not.
So sometimes there's always something that you forget to write about, and the compiler will report an error:
Copy Code code as follows:
Error 1 fatal error c1010:unexpected end of file while looking for precompiled header. Did you forget to add ' #include ' stdafx.h ' to your source?
D:\3_code\vc\forceincludedemo\forceincludedemo\demo.cpp 11
It would be nice to have the ability to precompile without adding stdafx.h.
Forceincludes
After a lookup, I found an option for/FI (Name forced Include File) in the compiler.
By using this option, you can avoid such a thing happening.
The setting of this parameter is in the project's Properties dialog box, specifically the force includes attribute in advanced under C + +.
as shown in figure: