/*帅得不敢出门C++哈哈堂 31843264编程`灌水`交流 24372952C++爱好者灌水天堂 3503799VC6.0(sp6)+Intel c++ Compiler For Windows v9.0.025 Final编译STLPort5.2.1转载请保留此信息*/编译前的准备:请确保 环境变量 path中有D:/vc6.0/MSDev98/Bin 原因及如何设置后面会说到(没设置的可先看后面)1. 到www.stlport.org下载STLPort。我下载的是stlport5.2.1 (http://sourceforge.net/project/showfiles.php?group_id=146814)2. 把下载的stlport压缩包解压,我假设解压到D:/VC98/STLport(其子目录是src,doc,stlport等目录)3. 编译stlport(1)编译d:/VC98/bin/vcvars32.bat给INCLUDE 变量 加上 %MSVCDir%/STLport/stlport给LIB变量加上 %MSVCDir%/STLport/lib改后应为set INCLUDE=%MSVCDir%/STLport/stlport;%MSVCDir%/ATL/INCLUDE;%MSVCDir%/INCLUDE;%MSVCDir%/MFC/INCLUDE;%INCLUDE%set LIB=%MSVCDir%/STLport/lib;%MSVCDir%/LIB;%MSVCDir%/MFC/LIB;%LIB%
开启一个console窗口, 运行 d:/VC98/bin/vcvars32.bat如果成功会提示:Setting environment for using Microsoft Visual C++ tools.(2)CD到STLport目录下执行如下命令:D:/VC98/STLport>configure msvc6 显示如下:STLport Configuration Tool for Windows
Setting compiler: Microsoft Visual C++ 6.0
Setting platform: Windows XP
Done configuring STLport.
Go to build/lib folder and type "nmake clean install" to build andinstall STLport to the "lib" and "bin" folders.Go to build/test/unit folder and type nmake clean install tobuild unit tests and install them in bin folder.
按照提示在CMD下输出如下命令:D:/VC98/STLport>cd build
D:/VC98/STLport/build>cd lib
D:/VC98/STLport/build/lib>nmake clean install结果我的电脑出现 "没有找到mspdb60.dll,因此这个应用程序未能启动" 错误解决方法有两种:第一种:Microsoft Visual Studio/Common/MSDev98/Bin中去找mspdb60.dll,然后把它复制到system32里就ok了!第二种:就是 环境变量 path中添加D:/vc6.0/MSDev98/Bin 注释再编译再编译如果是第一种方法后面又会出现问题 rc /I../../stlport /D "COMP=vc6" /D "BUILD_INFOS=/nologo /W4 /GX /GR /Zm800 /MD /Zi /O2" /fo obj/vc6/shared/stlport.res ../../src/stlport.rc'rc' 不是内部或外部命令,也不是可运行的程序或批处理文件。NMAKE : fatal error U1077: 'rc' : return code '0x1'Stop.
于是搜索rc.exe 在D:/vc6.0/MSDev98/Bin 找到了它设置环境变量右键我的电脑--属性--高级---环境变量---登录用户名的用户变量---变量path的值上添加 ;D:/vc6.0/MSDev98/Bin --确定--确定注销下再编译 编译成功 STLport下生成了bin 与lib文件夹
可见这两个问题都是由于环境变量不对导致的,所以编译前的准备是很重要的
4. 配置vc 点击vc的tools-options-Directories, 选择Include files,加入D:/VC98/STLport/stlport,并调到最前面 选择Library files,加入D:/VC98/STLport/LIB,并调到最前面将bin/目录下的三个*.dll文件拷贝到windows/system32/目录下
注意,编译时务必使用下面的格式:cl /GX /MT program.cppSGI STL中大量使用try..throw..catch,VC缺省情况下不支持此语法,/GX是要求VC++ Compiler打开对异常处理语法的支持。/MT则是要求VC的linker本程序obj文件与libcmt.lib连接在一起,因为SGI STL是thread-safe的,必须以multi-thread形式运行。若要在图形界面中使用,则:project-->setting(Alt+F7)->c/c++ Use run-time library Debug Multithreaded如果编译程序的时候出现:Fatal error cannot open "stlportd_static..lib" 就把stlportd_static.lib重命名为stlportd_static..lib至此, vc6.0编译stlport完成
如果是icc编译 (我下的是Intel C++ Compiler For Windows v9.0.025 Final安装在D:/ICC/下)注意:安装完icc后 一定要设置好icc的环境变量 否则编译过程不断出现的错误会让你很郁闷的,我为了这个问题搞了2天时间.比如连接的时候会出现 can not open file libmmd.lib的问题安装完后运行 开始--Intel(R) Software Development Tools--Intel(R) C++ Compiler 9.0---build Environment for IA-32 applications 给用户变量 变量include值添加: ;D:/ICC/Intel/Compiler/C++/9.0/IA32/Include变量lib添加: ;D:/ICC/Intel/Compiler/C++/9.0/IA32/Lib变量path添加: ;D:/ICC/Intel/Compiler/C++/9.0/IA32/Bin以上这几个值,装在不同目录自然不同,大家自行修改下
剩下的就简单了,跟VC6编译大部分一样,只是第3.(2)步命令应该修改如下:D:/VC98/STLport>configure icl显示如下:STLport Configuration Tool for Windows
Setting compiler: Intel C++ Compiler
Setting platform: Windows XP
Done configuring STLport.
Go to build/lib folder and type "nmake clean install" to build andinstall STLport to the "lib" and "bin" folders.Go to build/test/unit folder and type nmake clean install tobuild unit tests and install them in bin folder.其他同上了
如果同时用VC9和ICL编译的STLPort,两套库的名字是一样的,会冲突。解决方法:- 找到STLPort目录下的_auto_link.h我的是在D:/VC98/STLport/stlport/stl/config/下- 将下面一行# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF"."_STLP_VERSION_STR".lib"替换为# if defined (__ICL)# define _STLP_STLPORT_LIB_PREFIX "icl_"# else# define _STLP_STLPORT_LIB_PREFIX ""# endif
# define _STLP_STLPORT_LIB _STLP_STLPORT_LIB_PREFIX"stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF"."_STLP_VERSION_STR".lib"然后将ICL编译出的几个lib文件前加上“icl_”前缀,即:icl_stlport_static.5.1.lib 如果编译器出现can not open icl_stlportd_static..lib那么就把icl_stlportd_static.libicl_stlportd_static..lib 就是多加个.号如果生成的lib与dll分别在lib,bin的icl子目录下,就分别提取出来放在lib ,bin下(icl子目录没有用,可以删掉)完成...
