為了使用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
先設(shè)置一下VC6下的環(huán)境變量:C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT
把D:\STLport-5.1.2\stlport;加入Include路徑中;把D:\STLport-5.1.2\lib;加入Lib路徑中
在命令行窗口下:
運(yùn)行VCVARS32.BAT,然后
cd D:\STLport-5.1.2\build\lib
configure -c msvc6
nmake /fmsvc.mak install
編譯全部用的默認(rèn)選項(xiàng),因此編譯出來(lái)的是多線程靜態(tài)鏈接庫(kù)。庫(kù)文件被拷貝到D:\STLport-5.1.2\lib
3. 在VC6中使用STLport:
Tools->Options...->Directories中
include設(shè)置中添加目錄:D:\STLport-5.1.2\stlport
library設(shè)置中添加目錄:D:\STLport-5.1.2\lib
Project->Settings...->C/C++中
Category選擇Code Generation,然后在use run-time library中選擇Debug Multithreaded。(如果是release版本,選擇Multithreaded;如果想用動(dòng)態(tài)鏈接,則要先編譯動(dòng)態(tài)鏈接版本的STLport,再在這兒選擇相應(yīng)的DLL)
4. hash_map的例子:
#include <iostream>
#include <hash_map>
#include <string>

using namespace std;

int main()


{
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())

{
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
先設(shè)置一下VC6下的環(huán)境變量:C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT
把D:\STLport-5.1.2\stlport;加入Include路徑中;把D:\STLport-5.1.2\lib;加入Lib路徑中
在命令行窗口下:
運(yùn)行VCVARS32.BAT,然后
cd D:\STLport-5.1.2\build\lib
configure -c msvc6
nmake /fmsvc.mak install
編譯全部用的默認(rèn)選項(xiàng),因此編譯出來(lái)的是多線程靜態(tài)鏈接庫(kù)。庫(kù)文件被拷貝到D:\STLport-5.1.2\lib
3. 在VC6中使用STLport:
Tools->Options...->Directories中
include設(shè)置中添加目錄:D:\STLport-5.1.2\stlport
library設(shè)置中添加目錄:D:\STLport-5.1.2\lib
Project->Settings...->C/C++中
Category選擇Code Generation,然后在use run-time library中選擇Debug Multithreaded。(如果是release版本,選擇Multithreaded;如果想用動(dòng)態(tài)鏈接,則要先編譯動(dòng)態(tài)鏈接版本的STLport,再在這兒選擇相應(yīng)的DLL)
4. hash_map的例子:























