Tag Archives: Program error

Fatal error C1010: unexpected end of file encountered while looking for precompiled header. Did you forget to add “ා include” StdAfx. H to the source

Fatal Error C1010: Unexpected end of file encountered while looking for precompiled headers. Did you forget to add “#include” stdafx.h “to the source?
Error analysis:
this error occurs because the compiler is looking for a precompiled indicator header (default #include “stdafx.h”) when the file does not end as expected. The header file “stdafx.h” with precompiled instructions was not found.
(because the project of every CPP file attributes the default is to use the precompiled header (/ YU), but add a third party documents not # include “stdafx. H” precompiled directives, so the compiler in the CPP file until the end did not find it)
my this problem occurred in, by means of adding files to add to existing within the MFC one big tuo. H and. CPP file. These.h and.cpp files belong to the standard C++ open source code category and have no deeper relationship with MFC.
Solution: a.

1) in the solution explorer, right-click on the corresponding. CPP file, click “properties”
2) on the left side in the configuration properties, PM on “C/C + +”, click “precompiled header”
3) changes on the right side of the first line of “create/use precompiled header,” option from the “use precompiled header (/ Yu)” to “do not use the precompiled header”
4) note:
2.
(not recommended)
1) in the solution, right click on the project, click on properties
2) in the configuration properties -> c/c++ -> Changing “use the precompiled header (/YU)” to “do not apply the precompiled header”
in the precompiled header will make every compilation process very slow
Refer to the blog: http://blog.csdn.net/zrm_1995/article/details/68490749?locationNum=2& fps=1