error C2871: 'std' : does not exist or is not a namespace
#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: 'std' : does not exist or is not a namespace的更多相关文章
- 解决Eclipse中C++代码显示Symbol 'std' could not be resolved的问题
第一次在Eclipse中写C++代码,写了一个简单的hello world程序,还没有等我编译.就报出了各种错误,但是这么简单的代码.怎么可能这么多错误.于是没有理会.编译执行后,能够正常输出!!!H ...
- 【gradle报错】error: package org.apache.http does not exist
导入项目的时候gradle报错 error: package org.apache.http does not exist 解决方法: 在build.gradle中加入 android { use ...
- 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. ...
- 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 ...
- Error resolving template: template might not exist or might not be accessible是一句缩水报错?
一 thymeleaf在开发的时候本地调试正常,但是在测试环境打成jar包就报这个错误了. 二 template might not exist or might not be accessible ...
- role 'PLUSTRACE' does not exist
I have created a new user named watson and granted the related priviledges as following: SQL> cre ...
- error: 'for' 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 ...
- Error creating bean with name 'menuController': Injection of autowired dependency……
出现了一大串错误 Error creating bean with name 'userController': Injection of autowired dependencies failed. ...
- Error creating bean with name 'memcachedClient'...java.lang.OutOfMemoryError
1,Tomcat启动报错例如以下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating ...
随机推荐
- UNIX网络编程卷1 时间获取程序server TCP 协议相关性
本文为senlie原创.转载请保留此地址:http://blog.csdn.net/zhengsenlie 最初代码: 这是一个简单的时间获取server程序.它和时间获取程序client一道工作. ...
- Atitit. .net c# web 跟clientwinform 的ui控件结构比較
Atitit. .net c# web 跟clientwinform 的ui控件结构比較 .net 4.5 webform Winform 命名空间 System.Web.UI.WebContro ...
- 悟道—位IT高管20年的职场心经(读书笔记五)
悟道--一位IT高管20年的职场心经 第五章 搞定老板 "老板就是老板" 这一点,你可能会忘了,他一定不会忘: "老板不会总是老板" 这一点,他可能会忘,你最好 ...
- 勾股数组及其应用uva106
勾股数组 设三元组(a,b,c)满足a^2 + b^2 = c^2的勾股数组,那么是否存在无穷多个勾股数组呢, 答案是肯定的,将三元组乘以d,可以得到新的三元组(da,db,dc) 即(da)^2 + ...
- 【SICP归纳】2 高阶函数和数据抽象
上一篇博文相应的是书中的第一章的一二两节,我们已经大致的有了一种构造的感觉不是么. 书中展示了非常多有趣的句法(syntax). 如今我们要让思想进一步的抽象.写这篇博客的时候并未学完整本书.更不敢说 ...
- [Windows Phone] 地图覆叠层控制项(MapOverlay )
原文:[Windows Phone] 地图覆叠层控制项(MapOverlay ) 前言 当使用地图时,我们可能需要定位一些座标图示或是绘制一些文字线条,这时可以在地图上加上覆叠层进行绘制,在 Wind ...
- strcpy_s与strcpy对照
strcpy_s和strcpy()函数功能几乎相同.strcpy函数.就象gets函数一样,它没有方法来保证有效的缓冲区尺寸,所以它仅仅能假定缓冲足够大来容纳要拷贝的字符串.在程序执行时,这将导致不可 ...
- effective c++ 条款10 handle assignment to self operator =
非强制性,但是个好习惯 当使用连锁赋值时很有用 x=y=z=10; class Window { public: Window& operator=(int size) { ... retur ...
- js阻止冒泡
js阻止冒泡 (ev || event).cancelBubble = true; 标签切换 <script type="text/javascript"> windo ...
- RH033读书笔记(3)-Lab 4 Browsing the Filesystem
Lab 4 Browsing the Filesystem Sequence 1: Directory and File Organization 1. Log in as user student ...