VC6下使用STLPort
来源:互联网 发布:mac访问nas共享文件夹 编辑:程序博客网 时间:2024/05/21 20:21
1. STLport下载:http://www.stlport.org/
我下载的是最新版 02.25.07: STLport 5.1.2 released
2. STLport编译:
我的STLport目录是:D:/STLport-5.1.2
先设置一下VC6下的环境变量:C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT
把D:/STLport-5.1.2/stlport;加入Include路径中;把D:/STLport-5.1.2/lib;加入Lib路径中
在命令行窗口下:
运行VCVARS32.BAT,然后
cd D:/STLport-5.1.2/build/lib
configure -c msvc6
nmake /fmsvc.mak install
编译全部用的默认选项,因此编译出来的是多线程静态链接库。库文件被拷贝到D:/STLport-5.1.2/lib
3. 在VC6中使用STLport:
Tools->Options...->Directories中
include设置中添加目录:D:/STLport-5.1.2/stlport
library设置中添加目录:D:/STLport-5.1.2/lib
Project->Settings...->C/C++中
Category选择Code Generation,然后在use run-time library中选择Debug Multithreaded。(如果是release版本,选择Multithreaded;如果想用动态链接,则要先编译动态链接版本的STLport,再在这儿选择相应的DLL)
4. hash_map的例子:
#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;
}
stlport 5.10 编译 更加容易了(visual studio 2005)
进入%stlport%/build/lib目录
configure --help
此时会列出配置参数,其中:
-c <compiler> :配置所用的编译器,列表如下:
msvc6 Microsoft Visual C++ 6.0
msvc7 Microsoft Visual C++ .NET 2002
msvc71 Microsoft Visual C++ .NET 2003
msvc8 Microsoft Visual C++ 2005
icl Intel C++ Compiler
evc3 Microsoft eMbedded Visual C++ 3 (*)
evc4 Microsoft eMbedded Visual C++ .NET (*)
evc8 Microsoft Visual C++ 2005 compiling for CE
gcc GNU C++ Compiler (MinGW package)
dmc Digital Mars Compiler
bcc Borland C++ Compiler
我使用的是2005,所以使用:
-c msvc8
--rtl-static:编译为静态库(项目属性选择/MT会用到这个产生的lib)
--rtl-dynamic:编译为动态库(项目属性选择/MD会用到这个产生的lib)
--use-boost <boost install path>:如果使用boost这填入boost的安装目录
--extra-cxxflag <additional compilation options>:需要传给cl编译程序的另外的命令
如 /arch:SSE (启用sse优化) /arch:SSE2 (启用sse2优化)
几个重要的说完,我自己的配置命令是:
configure -c msvc8 --rtl-static --use-boost 我的boost目录
接着按提示
nmake /f msvc.mak clean
nmake /f msvc.mak
即完成了stl的编译
接下来将obj目录里生成的*.lib、*.dll、*.pdb、*.exp、*.dll.manifest复制到%stlport%/lib
windows path环境变量最后添加;%stlport%/lib
然后在visual studio的include目录添加%stlport%/stlport目录
lib 目录添加%stlport%/lib 目录
即可正常使用stlport了
注:%stlport%即指stlport安装目录
- VC6下使用STLPort
- VC6 下使用 STLPort
- Intel C++ 编译器在VC6下使用STLPort
- VC6中使用STLPort 5.1
- VC6 编译和使用 STLPort
- 在VC6下编译和安装STLport
- Win7下VS2010使用STLPort .
- Win7下VS2010使用STLPort .
- Win7下VS2010使用STLPort .
- STLPort 5.2.1 在VC6下的编译注意事项
- Windows平台上使用VC6编译安装STLport
- windows xp上使用vc6编译STLport-5.1.0
- VC6.0安装STLport
- VC6.0安装STLport
- 【笔记】【环境搭建】Ubuntu下使用STLPort
- VS2010下安装和使用STLport库
- vc6 编译 stlport 程序脚本
- 【转】vc6.0配置STLPort
- mysql 5.0存储过程学习总结
- 会选择比拥有美丽的容貌更重要
- 即时通讯编程(四)
- C#调用C++DLL的方法
- PHP 的 callback 类型
- VC6下使用STLPort
- ant中调用外部ant任务的两种方法
- 将java项目生成exe可执行文件全过程
- mysql备份(二)
- 接受不完美的自己
- 30年影响中国安防30人名单
- 容貌是可以改变的
- web 2.0海量小文件cache集群探讨(原创)
- mysq动态语句实例