梦想 就像鸡蛋
要么孵化 要么臭掉
要么孵化 要么臭掉
在C++中使用STL
Made In Zeal 转载请保留原始链接:http://www.zeali.net/entry/205
朋友问我:
“我用.net2005里面的vc7.0的一个问题:
#include <vector>//这个没报错,路径应该没问题
...
vector<int> i;//报错:error C2065: 'vector' : undeclared identifier c:\temp\aaaadlg.cpp 160
...
难道vc里面用c++的标准库要什么特殊设置?”
其实这是使用C++ Standard Library的基础问题。当使用标准库 -- 这里的vector用到了标准库里面比较常用也最具创新和扩展性的STL(Standard Template Library, 标准模板库) -- 时,include后面不用加.h,但是需要使用命名空间。命名空间的指定有两种方式:
| #include <vector> using namespace std; // 在这里声明 ... vector<int> i; ... |
或 者 |
#include <vector> ... std::vector<int> i; // 在这里显式声明 ... |
This Entry was Last Modified on 2007-05-28 09:59
没有评论.
发贴统计

我的地盘