fatal error C1010: unexpected end of file while looking for precompiled header directive

是预处理头文件问题

1、如果 cpp 头文件没有添加 include "stdafx.h" ,会报这样的错 。

2、确信 1 后 ,那么在工作区列表中右键 cpp 选 setting ---c/c++---Category---precompiled header---看一下预处理头文件名字 是否为 stdafx.h 。

3、也可以选择不适用预处理头文件 , 此时,cpp 前就不用加 stdafx.h 。