C BUG unexpected end of file while looking for precompiled header directive

在该cpp文件的最顶处插入
#include "stdafx.h"

这个是微软的硬性规定,当初就是这么设计的,使用预编译技术,必须要将那些预编译的头文件放置在每个cpp文件的最顶处,而预编译的头文件声明是放在stdafx.h文件中的。
stdafx.h中的的声明是项目中每个cpp文件都需要包含的,而且要一致。
如下:
1. 正确
#include "stdafx.h"
#include <stdio.h>
int main(){...}
...
2.正确
#include "stdafx.h"
...
3.错误
#include <stdio.h>
#include "stdafx.h"
int main(){...}
4.错误(楼主应该是这种写法导致的错误)
#include <stdio.h>
int main(){...}

上述情况都是在你讲选项中的使用预编译头文件勾选上的时候。。。。没有使用预编译头文件则没有这些要求。
如何不勾选:
(1). [Project] - [Settings] - [C/C++] - [Category] 
(2). 选择 [Precomplied Headers]
(3). 单选 [Not Using Precomplied Headers] 或者 [Autometic...]
(4). [OK]
原文地址:https://www.cnblogs.com/vipwtl/p/5922979.html