文件的意外结束
Unexpected end of a file
当尝试在VS2010 Ultimate sp1中#包括任何std头在"stdafx.h"我得到一个错误:
致命错误C1004:发现意外的文件结束符
有没有其他人遇到过这种情况,或者我的安装有问题?
编辑
我的main是这样的:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
stdafx.h看起来像这样:
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
#include <_dbdao.h>//if I remove this line it will compile
stdafx.cpp如下所示:
#include "stdafx.h"
AND THERE IS MORE
Visual Studio编译器给出这个错误有几个原因。MSDN在这里解释
编译器到达源文件的末尾而没有解析构造。该代码可能缺少以下元素之一:
右括号
右括号
结束注释标记(*/)
分号
我猜它不是真的与stdafx.h文件有关,而是你有一个这样的类:
class A {
...
}
,不带}
后面的分号。必须是
class A {
...
};
如果这不能解决问题,你应该按照第14条的建议去做。排除,直到它编译找到原因。
如果使用预编译头文件,则需要在项目中的每个源文件中包含stdafx.h。否则会导致您在这里引用的错误信息。
相关文章:
- 为什么在这个代码结束循环中没有得到结束
- 在C++中对T*类型执行std::move的意外行为
- 使用取消引用的指针的多态性会产生意外的结果.为什么?
- 试图对缓存进行跨步测试,但程序并没有结束
- 处理除以零会导致<csignal>意外行为
- 当调用switch语句中的函数时(即使函数不包含循环),似乎是永不结束的循环的问题
- vscode下的Arduino代码出现意外编译错误
- 在意外功能结束时进行清理,标准等效
- STD :: Istream意外结束
- C++ 循环意外结束
- .hpp 文件上的意外文件结束错误
- Qt GUI应用程序意外结束
- 链接静态库时意外结束
- #include在查找预编译头文件时跳过——查找预编译头文件时意外结束
- 我的节目意外结束了
- 语法错误,意外的标记,期望文件结束
- 当QFileDialog::getOpenFileName窗口打开时,程序已意外结束
- 线程意外结束.c++
- 文件的意外结束
- 在Qt Windows上.节目意外地结束了