#include <iostream.h>

using namespace std;

然后编译时出现 error C2871: 'std' : does not exist or is not a namespace



查了一下,原来 C++有两个不同版本号的头文件。引入名字空间这个概念曾经编译器用的是#include <iostream.h>,

而引入名字空间的概念以后std名字空间的头文件名称字变成了<iostream>。



<iostream.h>是比較老的C++的头文件的版本号,而namespace是98年才被增加C++标准的,所以<iostream.h>里面是没有std这么个命名空间的,当使用 <iostream.h>时,相当于在c中调用库函数,使用的是全局命名空间,也就是早期的c++实现。头文件<iostream>则未定义全局命名空间,使用时必须使用namespace
std才干正确使用cout。



vc6.0支持这个两个版本号. 只是如今都用<iostream>了   



所以仅仅需将以上语句改为:

#include <iostream> 

using namespace std;

或者是 #include <iostream.h>就可以。

error C2871: &#39;std&#39; : does not exist or is not a namespace的更多相关文章

  1. 解决Eclipse中C++代码显示Symbol &#39;std&#39; could not be resolved的问题

    第一次在Eclipse中写C++代码,写了一个简单的hello world程序,还没有等我编译.就报出了各种错误,但是这么简单的代码.怎么可能这么多错误.于是没有理会.编译执行后,能够正常输出!!!H ...

  2. 【gradle报错】error: package org.apache.http does not exist

    导入项目的时候gradle报错 error: package org.apache.http does not exist 解决方法: 在build.gradle中加入 android {   use ...

  3. Error resolving template [xxx], template might not exist or might not be exist

    Springboot+thymeleaf+mybatis 抛Error resolving template [xxx], template might not exist的异常 原因是我们在pom. ...

  4. Error 2 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'

    Error 2 error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree ...

  5. Error resolving template: template might not exist or might not be accessible是一句缩水报错?

    一 thymeleaf在开发的时候本地调试正常,但是在测试环境打成jar包就报这个错误了. 二 template might not exist or might not be accessible ...

  6. role &#39;PLUSTRACE&#39; does not exist

    I have created a new user named watson and granted the related priviledges as following: SQL> cre ...

  7. error: &#39;for&#39; loop initial declarations are only allowed in C99 mode

    error: 'for' loop initial declarations are only allowed in C99 mode 使用gcc编译代码是报出 error: 'for' loop i ...

  8. Error creating bean with name &#39;menuController&#39;: Injection of autowired dependency……

    出现了一大串错误 Error creating bean with name 'userController': Injection of autowired dependencies failed. ...

  9. Error creating bean with name &#39;memcachedClient&#39;...java.lang.OutOfMemoryError

    1,Tomcat启动报错例如以下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating ...

随机推荐

  1. C语言中结构体參数变量的传递

    [文章摘要] 在C语言中,结构体參数变量常常作为函数的參数来进行传递.但假设參数设置不当.会出现内存问题. 本文以实际的程序代码为例.具体地介绍怎样正确地使用结构体參数变量.为相关的开发工作提供了參考 ...

  2. mysql经常使用的命令

    如何登陆数据库     飞机着陆     mysql -u <username> -p     访问本机数据库     mysql -u <username> -D <d ...

  3. NET Core控制反转(IoC)

    ASP.NET Core中的依赖注入(1):控制反转(IoC)   ASP.NET Core在启动以及后续针对每个请求的处理过程中的各个环节都需要相应的组件提供相应的服务,为了方便对这些组件进行定制, ...

  4. docker 现实---中小企业docker环境结构(五)

    docker对于中小企业,设定paas他没有足够的能量,没有必要为,个人二手sandbox实用性和小点.我个人觉得,中小企业可以使用docker要规范发展.测试.生产环境. 他画了一个简单的图表: d ...

  5. bootstrap在 刷新页面,tab选择页面不会改变。

    您可以直接复制代码 注意在同级别文件夹中引用 相应js 和 css. 实现tab影响 关键看bootstrap的 data-toggle= tab <html lang="en&quo ...

  6. listary文件查找程序下载和使用

    资源:PHP开发学习门户网站 地址:http://bbs.phpthinking.com/forum.php?mod=viewthread&tid=173 Listary 是一款有用的国产Wi ...

  7. silverlight与wcf双向通讯 例子

    本文将建立一个silverlight与wcf双向通讯的简单实例,以下是详细步骤: 新建Silverlight应用程序,名称WCFtest.解决方案中添加WCF服务应用程序,名称WcfServiceTe ...

  8. 活动图(Activity Diagram) - 项目分解文章

    案例基础上登录用户进行操作的每个模块. 1. 员 (1) 列车顺序表 (2) 货车装卸报告(数据处理) (3) 货车装卸报告(查看) 2. 管理员 (1) password管理 (2) 查看日志 (3 ...

  9. JAVA技术交流群

    推荐:组[八方扑灭]:http://jq.qq.com/?_wv=1027&k=RFLXu0. QQ: 292352612  集团专注于技术.软件project.JAVA.c\c++.WEB. ...

  10. iOS 中client和server的 Web Service 网络通信 (2)

    在实际的应用开发过程中,同步请求的用户体验并非非常好:我们都知道.Apple是非常重视用户体验的.这一点也成为了行业的标杆,没实用户哪里来的好产品.所以用户体验是极其重要的.貌似废话有点多.接下来进入 ...