为了使用hash_map,今天下载了STLport,在VC6下编译成功。
1. STLport下载: http://www.stlport.org/
我下载的是最新版 02.25.07: STLport 5.1.2 released
2. STLport编译:
我的STLport目录是:D:\STLport-5.1.2
先设置一下VC6下的环境变量:C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT
把D:\STLport-5.1.2\stlport;加入Include路径中;把D:\STLport-5.1.2\lib;加入Lib路径中
在命令行窗口下:
运行VCVARS32.BAT,然后
cd D:\STLport-5.1.2\build\lib
configure -c msvc6
nmake /fmsvc.mak install
编译全部用的默认选项,因此编译出来的是多线程静态链接库。库文件被拷贝到D:\STLport-5.1.2\lib
3. 在VC6中使用STLport:
Tools->Options...->Directories中
include设置中添加目录:D:\STLport-5.1.2\stlport
library设置中添加目录:D:\STLport-5.1.2\lib
Project->Settings...->C/C++中
Category选择Code Generation,然后在use run-time library中选择Debug Multithreaded。(如果是release版本,选择Multithreaded;如果想用动态链接,则要先编译动态链接版本的STLport,再在这儿选择相应的DLL)
4. hash_map的例子:
#include
<
iostream
>
#include
<
hash_map
>
#include
<
string
>
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
using
namespace
std;
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
int
main()
![](https://i-blog.csdnimg.cn/blog_migrate/2f88ce130b654eb5dc6788e02dbcfc90.gif)
{
hash_map<int, string> mymap;
mymap[2008]="VC6";
mymap[999999]="STLport";
mymap[123456]="hello hash_map!";
hash_map<int, string>::iterator iter = mymap.find(123456);
if(iter != mymap.end())
![](https://i-blog.csdnimg.cn/blog_migrate/f70a0fde2b51b7dd92a70e712e540cf6.gif)
{
cout<<iter->second<<endl;
}
return 0;
}
1. STLport下载: http://www.stlport.org/
我下载的是最新版 02.25.07: STLport 5.1.2 released
2. STLport编译:
我的STLport目录是:D:\STLport-5.1.2
先设置一下VC6下的环境变量:C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT
把D:\STLport-5.1.2\stlport;加入Include路径中;把D:\STLport-5.1.2\lib;加入Lib路径中
在命令行窗口下:
运行VCVARS32.BAT,然后
cd D:\STLport-5.1.2\build\lib
configure -c msvc6
nmake /fmsvc.mak install
编译全部用的默认选项,因此编译出来的是多线程静态链接库。库文件被拷贝到D:\STLport-5.1.2\lib
3. 在VC6中使用STLport:
Tools->Options...->Directories中
include设置中添加目录:D:\STLport-5.1.2\stlport
library设置中添加目录:D:\STLport-5.1.2\lib
Project->Settings...->C/C++中
Category选择Code Generation,然后在use run-time library中选择Debug Multithreaded。(如果是release版本,选择Multithreaded;如果想用动态链接,则要先编译动态链接版本的STLport,再在这儿选择相应的DLL)
4. hash_map的例子:
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/cbef093dcc044b2793832001e2365e43.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/2f88ce130b654eb5dc6788e02dbcfc90.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/dbf989d57862681739b642d8621fe1f0.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/918e8df969f9f8c8d002f25cda86cade.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/f70a0fde2b51b7dd92a70e712e540cf6.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/edb48e6f68462ea23d9a824f01de40c5.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/918e8df969f9f8c8d002f25cda86cade.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/4a5daaec04350a363f186a4d2c5ed6ce.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/df37983f39daa189b8c814e01a6a9011.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/0ac3a2d53663ec01c7f7225264eeefae.gif)