1.download STLport source code
http://sourceforge.net/projects/stlport/
2.解壓源代碼到根目錄下(C/D...)
3.配置編譯檔案,生成适合的makefile
在STLprot-X.X.X目錄下,我們會發現一個configure.bat批處理檔案,在指令行下運作configure.bat --help可檢視幫助。
如果使用VC6 IDE,可以運作 configure.bat msvc6,其他版本的可參考幫助
4.配置D:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT檔案
在include及Lib路徑清單前添加STLPort路徑,可參考如下:
set INCLUDE=C:/STLport-5.2.1/stlport;%MSVCDir%/ATL/INCLUDE;%MSVCDir%/INCLUDE;%MSVCDir%/MFC/INCLUDE;%INCLUDE%
set LIB=C:/STLport-5.2.12/lib;%MSVCDir%/LIB;%MSVCDir%/MFC/LIB;%LIB%
5. 進入build/lib目錄下,先運作D:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT,然後再輸入nmake clean install.
6. 編譯成功後,設定msvc6的Include和Libirary路徑。記住stlport路徑需要設定在其他msvc路徑之前。
7.由于msvc6建立的項目的預設設定都是單線程的,是以需要在Code Generation中設定為支援多線程(MD,MDd,MT,MTd).
如果設定為single thread,通常會出現如下的link錯誤:
error LNK2001: unresolved external symbol "class stlpmtx_std::basic_ostream<char,class stlpmtx_std::char_traits<char> > stlpmtx_std::cout" ([email protected][email protected]@[email protected][email protected]@[email protected]@@[email protected])