关于VC中 error C2871: 'std' : does not exist or is not a namespace
来源:互联网 发布:网络贷款的弊端 编辑:程序博客网 时间:2024/06/16 20:50
#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>即可。
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>即可。
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- 关于error C2871: 'std' : does not exist or is not a namespace处理
- 关于error C2871: ''std'' : does not exist or is not a namespace处理
- error C2871: 'std' : does not exist or is not a namespace
- C++ 编译出现: error C2871: 'std' : does not exist or is not a namespace 怎么解决
- error C2871: 'std' : does not exist or is not a namespace
- error C2871: 'std' : does not exist or is not a namespace
- error C2871: 'System' : a namespace with this name does not exist
- Error starting static Resources:* does not exist or is not a readable directory
- does not exist or is not a readable directory
- ..\TestApp does not exist or is not a readable directory
- Error: ‘shared_ptr’ in namespace ‘std’ does not name a type
- netbean中does not exist or is not a readable错误的解决
- netbean中does not exist or is not a readable错误的解决
- 开源的Android视频播放器--更新主界面,添加网页浏览
- 杭电--1207--汉诺塔II--数学题
- Unity Transform.Find与Transform.FindChild的关系?
- 存储过程和触发器
- shell test用法
- 关于VC中 error C2871: 'std' : does not exist or is not a namespace
- 【XML系列】-----XML文档格式
- Ecshop错误大汇总
- 【Java学习笔记】基础知识学习9【可变字符串】
- 关于剪切板操作编程
- xdu 1201 An Unfair Game 二分图匹配
- 杭电--1995--汉诺塔V--数学题
- linux压缩和解压缩命令大全
- Google glog