#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. cocos2dx 3.1从零学习(六)——CocosStudio(VS2013project导入及环境设置)

    导入libCocosStudio.libExtensions.libGUI 新建的project例如以下图: 加入现有项目 右键解决方式.例如以下操作: watermark/2/text/aHR0cD ...

  2. ExtJS与JQuery对照

    首先在介绍ExtJS和JQuery,然后进行比较 一个.什么是ExtJS? 1.ExtJS能够用来开发RIA也即富client的AJAX应用,是一个用javascript写的,主要用于创建前端用户界面 ...

  3. 训练赛 Grouping(强连通分量缩点 + DAG求最长路)

    http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=158#problem/F 大致题意:给出n个人和m种关系(ti,si),表示ti ...

  4. ecshop购物流程中去掉email邮箱

    首先打开includes\lib_order.php,在第1688行左右找到并删除 !empty($consignee['email']) && 接着打开js\shopping_flo ...

  5. 用户手册User Guide的写法

    下面的内容仅代表个人观点,是在工作中总结出来的,如果有错误之处,还请指教. 转载请注明来自博客园---”邦邦酱好“: http://www.cnblogs.com/bangbangjiang/p/36 ...

  6. substance的使用示例(转)

    可以使用substance改变界面的皮肤和主题,让Java制作的界面“炫”起来 . 可以下载substance.jar文件 在代码中你可以用: static { try { try { UIManag ...

  7. The JSR-133 Cookbook for Compiler Writers(an unofficial guide to implementing the new JMM)

    The JSR-133 Cookbook for Compiler Writers by Doug Lea, with help from members of the JMM mailing lis ...

  8. java.lang.OutOfMemoryError: Java heap space错误和方法(集、转)

    错误的方式来解决溢出下面的堆空间是从网上找: java.lang.OutOfMemoryError: Java heap space ================================= ...

  9. Jquery中使用setInterval和setTimeout 容易犯的低级错误

    直接在ready中调用其他方法,会提示缺少对象的错误,解决方法如下: 方法1. 应用jQuery的扩展可以解决这个问题. $(document).ready(function(){ $.extend( ...

  10. QoS令牌桶工作原理

    QoS的一个重要作用就是对port流量进行监管,也就是限制port流量.但QoS是怎样做到这点的呢?那就是QoS的令牌桶机制了.以下是在笔者刚刚出版的<Cisco/H3C交换机高级配置与管理技术 ...