C++中的错误分析
来源:百度知道 编辑:UC知道 时间:2024/06/05 02:32:20
我运行一个程序(很长,就不拿出来了),出现这样的错误:
error C2871: 'std' : does not exist or is not a namespace
请各位大侠帮帮忙,小弟万分感谢~~
指出错误的原因和怎么样修改,谢谢了~~
何谓STL?我不知道那个是什么东东,好像也没有用~~
error C2871: 'std' : does not exist or is not a namespace
请各位大侠帮帮忙,小弟万分感谢~~
指出错误的原因和怎么样修改,谢谢了~~
何谓STL?我不知道那个是什么东东,好像也没有用~~
#include <iostream>
using namespace std;
你确定这么写了吗
没有std名字空间存在,确认你是否用了STL?
必须要写
#include <iostream>
以及
using namespace std;
将#include <iostream.h>改为#include <iostream>即可,因为#include <iostream.h>是旧的编译方式
这个问题涉及到了命名空间。
你所使用 的STL 实际上是一个库文件。
而这个库文件有一个统一的命名空间。
#include <iostream.h>
std::cout<<"Hello World!"<<endl ;
#include <iostream>
using namespace std ;
=============
STL 是C++标准模板库。
你可以看看有关这个的书。如果要学C++ 或将来的MFC 这个STL 还是比较重要的。
建议要看看:其中比较常用的有:
list vector map string 等。
cout<<"Hello World!"<<endl ;
以上这两种方法都可以。 但很多的都要具体的看你的所使用的编译器了。