奇怪的郁闷啊!!! 这句#include "iostream" 怎么了?

xp4105 2010-04-03 07:59:47
今天教侄子学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坏了,就重装,还是一样的结果。
郁闷,不知道到底怎么回事。
请大家帮助,谢谢。
...全文
241 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xp4105 2011-06-13
  • 打赏
  • 举报
回复
楼上的大熊猫
我1年前的问题 你今天遇到了
呵呵
  • 打赏
  • 举报
回复
谢谢,我碰到了这个问题。
xp4105 2010-04-03
  • 打赏
  • 举报
回复
找到问题了
前几天我设置VS2005编译驱动
结果在WDK包含的头文件和VS2005的有冲突
谢谢大家
awangjacky 2010-04-03
  • 打赏
  • 举报
回复
用iostream.h

代替iostream试试。
  • 打赏
  • 举报
回复
没碰到做这个问题 奇怪
hzy694358 2010-04-03
  • 打赏
  • 举报
回复
#include <iostream>
试试
xp4105 2010-04-03
  • 打赏
  • 举报
回复
不是using namespace std;的问题啊 ,我是加上的

代码如下: 太奇怪了
====================================================
// stdafx.h : 标准系统包含文件的包含文件,

#pragma once
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <tchar.h>

=================================================
// hello.cpp : 定义控制台应用程序的入口点。
#include "stdafx.h"
#include "iostream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}


================================================
// stdafx.cpp : 只包括标准包含文件的源文件
#include "stdafx.h"
zyyoung 2010-04-03
  • 打赏
  • 举报
回复
using namespage std;

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧