奇怪的郁闷啊!!! 这句#include "iostream" 怎么了?
今天教侄子学VC,就建了一个控制台应用程序。
啥也没有添加,编译正常。
但在hello.cpp文件头处加了一个#include "iostream",了不得了。
报错一大堆:
------ 已启动全部重新生成: 项目: hello, 配置: Debug Win32 ------
正在删除项目“hello”(配置“Debug|Win32”)的中间文件和输出文件
正在编译...
stdafx.cpp
正在编译...
hello.cpp
h:\vs2005\vc\include\iosfwd(34) : error C2146: syntax error : missing ';' before identifier 'fpos_t'
h:\vs2005\vc\include\iosfwd(34) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(35) : error C2143: syntax error : missing ';' before 'const'
h:\vs2005\vc\include\iosfwd(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(35) : error C2734: 'std::_BADOFF' : const object must be initialized if not extern
h:\vs2005\vc\include\iosfwd(200) : error C2144: syntax error : 'int' should be preceded by ';'
h:\vs2005\vc\include\iosfwd(288) : see reference to class template instantiation 'std::char_traits<_Elem>' being compiled
h:\vs2005\vc\include\iosfwd(200) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(200) : error C2143: syntax error : missing ';' before '*'
h:\vs2005\vc\include\iosfwd(200) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(200) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(200) : error C2061: syntax error : identifier '_Elem'
h:\vs2005\vc\include\iosfwd(202) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(205) : warning C4183: 'copy': missing return type; assumed to be a member function returning 'int'
h:\vs2005\vc\include\iosfwd(207) : error C2143: syntax error : missing ';' before '*'
h:\vs2005\vc\include\iosfwd(207) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(207) : error C2086: 'int std::char_traits<_Elem>::_Elem' : redefinition
h:\vs2005\vc\include\iosfwd(200) : see declaration of 'std::char_traits<_Elem>::_Elem'
h:\vs2005\vc\include\iosfwd(207) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(207) : error C2061: syntax error : identifier '_Elem'
h:\vs2005\vc\include\iosfwd(209) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(217) : warning C4183: '_Copy_s': missing return type; assumed to be a member function returning 'int'
h:\vs2005\vc\include\iosfwd(219) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
h:\vs2005\vc\include\iosfwd(219) : error C2143: syntax error : missing ';' before '*'
h:\vs2005\vc\include\iosfwd(219) : error C2373: 'std::char_traits<_Elem>::_Elem' : redefinition; different type modifiers
生成日志保存在“file://d:\tt\hello\hello\Debug\BuildLog.htm”
hello - 181 个错误,23 个警告
========== 全部重新生成: 0 已成功, 1 已失败, 0 已跳过 ==========
开始以为是VC2005坏了,就重装,还是一样的结果。
郁闷,不知道到底怎么回事。
请大家帮助,谢谢。