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的源代码中调试
开始享受STLPORT吧。
---------------------------------终于搞定的分割线------------------------------------
这部分非转贴,网上百度google了一堆,总算找到一篇真正能让我安装好stlport的文章,好了,从现在开始玩stl。