unexpected end of file while looking for precompiled header directive

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 20:11:00

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

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
int main(){...}
...
2.正确
#include "stdafx.h"
...
3.错误
#include
#include "stdafx.h"
int main(){...}
4.错误(楼主应该是这种写法导致的错误)
#include
int main(){...}
上述情况都是在你讲选项中的使用预编译头文件勾选上的时候.没有使用预编译头文件则没有这些要求.