stlport 5.2.1在VC6下安装过程
1、编辑VCVARS32.BAT
我的这个文件对应的地方是D:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT
将倒数第3、4行的内容改为如下
set INCLUDE=D:\STLport-5.2.1\stlport;%MSVCDir%\ATL\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\MFC\INCLUDE;%INCLUDE%
set LIB=D:\STLport-5.2.1\lib;%MSVCDir%\LIB;%MSVCDir%\MFC\LIB;%LIB%
2、开启一个终端窗口输入以下命令
D:\>"D:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
cd D:\STLport-5.2.1
configure msvc6
cd build\lib
nmake clean install
等待一会儿
将出现以下内容表示成功了
copy obj\vc6\static-stlg\stlportstld_static.lib ..\..\lib\
已复制 1 个文件。
已复制 1 个文件。
将以下代码存为CMD文件直接运行就可以编译STLPORT 5.2.1 FOR VC6
@echo off echo VCVARS32.BAT 配置好了吗?? pause
d:
cd "D:\Program Files\Microsoft Visual Studio\VC98\Bin"
rem “call VCVARS32.BAT” 和“COMMAND/C VCVARS32.BAT”是一样的 在xp下没验证
call VCVARS32.BAT
cd D:\STLport-5.2.1
call configure msvc6
cd build\lib
call nmake clean install
将以下代码存为CMD文件直接运行就可以编译STLPORT 5.2.1 FOR VC9
@echo off echo VCVARS32.BAT 配置好了吗?? pause
d:
cd "D:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools"
call VCVARS32.BAT
cd D:\STLport-5.2.1
call configure msvc9
cd build\lib
call nmake clean install
3、编译完了,如何集成到VC6呢
打开VC6 tool/options/Directories/
include files 把d:\STLport-5.2.1\stlport目录加入,并且把目录提前到第一位[重要]。
library files 把d:\STLport-5.2.1\lib目录加入
4、注意这是我机器的目录,按你机器实际目录
D:\STLport-5.2.1>configure --help
STLport Configuration Tool for Windows
The first parameter must be the compiler name, here are the available
keywords:
msvc6 Microsoft Visual C++ 6.0
msvc7 Microsoft Visual C++ .NET 2002
msvc71 Microsoft Visual C++ .NET 2003
msvc8 Microsoft Visual C++ 2005
msvc9 Microsoft Visual C++ 2008
icl Intel C++ Compiler
evc3 Microsoft eMbedded Visual C++ 3 (*)
evc4 Microsoft eMbedded Visual C++ .NET (*)
evc8 Microsoft Visual C++ 2005 compiling for CE
evc9 Microsoft Visual C++ 2008 compiling for CE
(*) For these compilers the target processor is determined automatically.
You must run the WCE*.BAT file you wish to build STLport for before
running configure.
Then the following options are available:
"-p <platform>" or "--platform <platform>"
Build STLport for the specified platform. Not all existing platforms are
available, only the ones that make a difference when building STLport are.
The following keywords are available:
win95 Windows 95 compatible
win98 Windows 98 and up to Windows XP excluded
winxp Windows XP or later (default)
"-x"
Enables cross-compiling; the result is that all built files that are
normally put under "bin" and "lib" get extra subfolders depending on
the compiler name.
"--with-static-rtl"
"--with-dynamic-rtl"
Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family)
C/C++ runtime library when linking with STLport. If you want your appli/dll
to link statically with STLport but using the dynamic C runtime use
--with-dynamic-rtl; if you want to link dynamicaly with STLport but using the
static C runtime use --with-static-rtl. See README.options for details.
Don't forget to signal the link method when building your appli or dll, in
stlport/stl/config/host.h set the following macro depending on the configure
option:
"--with-static-rtl -> _STLP_USE_DYNAMIC_LIB"
"--with-dynamic-rtl -> _STLP_USE_STATIC_LIB"
"--use-boost <boost install path>"
Request use of boost support (www.boost.org). For the moment only the boost
type_traits library is used to get type information and to implement some
specific workaround not directly implemented by STLport. To use the same
support when using STLport for your application don't forget to define
_STLP_USE_BOOST_SUPPORT in stlport/stl/config/user_config.h file.
"--without-thread"
Per default STLport libraries are built in order to be usable in a multithrea
ded
context. If you don't need this you can ask for a not thread safe version wit
h
this option.
"--without-rtti"
Remove rtti (run time type information) support if available.
"--extra-cxxflag <additional compilation options>"
Use this option to add any compilation flag to the build system. For instance
it can be used to activate a specific processor optimization depending on you
r
processor. For Visual C++ .Net 2003, to activate pentium 3 optim you will use
:
--extra-cxxflag /G7
If you have several options use several --extra-cxxflag options. For instance
to also force use of wchar_t as an intrinsic type:
--extra-cxxflag /G7 --extra-cxxflag /Zc:wchar_t
"--with-lib-motif <motif>"
Use this option to customize the generated library name. The motif will be use
d
in the last place before version information, separated by an underscore, ex:
stlportd_MOTIF.5.0.lib
stlportstld_static_MOTIF.5.1.lib
Do not forget to define _STLP_LIB_NAME_MOTIF macro in STLport configuration fi
le
to the same value if you want to keep the auto link feature supported by some
compilers.
"--without-stlport"
Option specially targetting build of the unit tests project without STLport. T
his
is a good way to challenge the C++ Standard library implementation comming wit
h
your compiler with STLport.
"--clean"
Removes the build configuration file.
D:\STLport-5.2.1>
用VC6编译STLPORT(ZT) 收藏(转载)
STLport Features: STLport is a multiplatform ANSI C++ Standard Library implementation. It is free, open-source product, featuring the following:
Advanced techniques and optimizations for maximum efficiency
Exception safety and thread safety 异常安全,线程安全,能做到线程安全很不错的
Important extensions - hash tables, singly-linked list, rope 拥有hash表,巨型string rope,oh yeah
可移植性,stlport之所以叫stlport,就是因为她的高可移植性
Portability: With STLport, you rely on uniform solid code base for all compilers used in the project. Here is a list of compilers
supported by STLport. Started as a one-person effort in 1997, it has now become, with the help of numerous contributors, an excellent choice for multiplatform projects. You may learn more about STLport story here.
STLport Distinction: STLport works on any platform possible and proves itself as a seamless drop-in for modern production environments.
Not only that - it also offers important functionality not provided by any other standard library vendor:
Debug mode: "Safe iterators" and preconditions with rigorous runtime validity checking. debug模式,这个问题有机会我介绍,VC8的STL也有这个功能
Immediately reports STL bugs undetectable otherwise.
Wide range of configuration knobs to fit particular requirements of your project, including use in embedded systems, such as vxWorks or
Windows CE. 能够在嵌入式操作系统中允许,效率不用怀疑
Free Commercial Use: There are absolutely no restrictions on STLport use in commercial projects, and no royalties are involved. There is
no GPL. Please read your free license for details. 免费给你用
再说一下,STLPORT是基于SGI STL的,SGI STL很牛B,STL之父作品。
下载请到sourceforge,解压,假设为E:\STLport-5.2.1,打开CMD,切换到这个目录
编译步骤如下:
1> cmd, configure.bat msvc6 --with-static-rtl 解释一下这些参数的作用,msvc6是VC6平台,--with-static-rtl,静态链接[重要]。
更多请参考configure.bat --help
2> cd build/lib
3> run vcvars32.bat 设置编译环境,在VC6的安装目录下找
4> nmake /fmsvc.mak install
5> 手工删除/build/obj目录,全是临时文件,放心删除。
如果你还想检验一下编译效果。
接着:
6> cd ../build/test/unit nmake /fmsvc.mak install
编译的时候,ctype_facets_test.cpp会提示有一个小错误,我不熟悉CPPUNIT,把那句注释了就行了:-),同样,删除那些临时文件
执行一下bin 目录下的那些test可执行文件就OK了。
编译完了,如何集成到VC6呢?
打开VC6 tool/options/Directories/
include files 把E:\STLport-5.2.1\stlport目录加入,并且把目录提前到第一位[重要]。注意这是我机器的目录,按你机器实际目录
library files 把E:\STLport-5.2.1\lib目录加入
测试一下效果
新建一个WIN32 console工程
#include <iostream>
int main()
{
std::cout << "Hello, STLPORT" << std::endl;
return 0;
}
打开project\settings\C/C++
Code Generation 改成Debug Multithreaded
如果是release改成Multithreaded [重要]
编译,调试,F11,可以看到进入了STLPORT的源代码中调试

浙公网安备 33010602011771号