现在的位置: 首页 > 综合 > 正文

boost stlport for vs2008 安装

2018年02月08日 ⁄ 综合 ⁄ 共 1602字 ⁄ 字号 评论关闭

下载 STLProt5.21(700k左右)

1解压,注意解压到一个没有中文和空格的路径下,否则后患无穷,我的路径是 D:\Library\STLport-5.2.1

2打开vs2008命令行 输入 configure msvc9

3 进入目录 D:\Library\STLport-5.2.1\build\lib

4 输入:nmake clean install

5 在vs2008 中配置 包含文件和库文件

6 把D:\Library\STLport-5.2.1\bin 下的所有dll 复制到 c:\windows 下 (copy *.dll  c:\windows)

到此 STLProt 安装完毕

 

测试一下是否安装成功:

 

#include<iostream>

#include <rope>

#include<hash_map>

 

using namespace std;

int main()

{

//crope

cropebigstr = "Hello word";

bigstr+= " test!";

cout<<bigstr<<endl;

 

//hash_map

std::hash_map<int,crope>myMap;

myMap[100]= "One hundred";

myMap[200]= "Two hundred";

cout<<myMap[200]<<endl;

getchar();

return0;

}

 

如果可以运行,证明 STLPort 安装成功了

 

boost 安装:

1  先下载boost,我的版本是boost_1_48_0

2  解压,我的目录是D:\Library\boost_1_48_0

3  支持STLPort, 修改 D:\Library\boost_1_48_0\tools\build\v2\user-config.jam, 找到配置 STLPort的地方    (其实无所谓了,随便放也行)写入这么一行:

     using stlport :STLport-5.2.1 : "D:/Library/STLport-5.2.1/stlport" :"D:/Library/STLport-5.2.1/lib" ;

      "D:/Library/STLport-5.2.1/stlport"它就像是vs2008 中的包含文件目录

      "D:/Library/STLport-5.2.1/lib";它就像是vs2008 中的库文件目录

       注意:斜杠的方向是"/"而不是我们平进用的"\",还有你的路径中最好不要有中文或者是空格.

4  打开vs2008的命令行,来到 D:\Library\boost_1_48_0 下,输入bootstrap.bat ,等一下..

5 bjam--toolset=msvc --build-type=complete stage stdlib=stlport

6 等........ 很久 ,上面的命令是编译boost的所有库当然你也可以

    编译指定的库,例如只编译 线程库

     bjam --with-thread --toolset=msvc--build-type=complete stage stdlib=stlport

     编译除此之外的库,例如: 编译除python库之外的所有库

     bjam --without-python --toolset=msvc--build-type=complete stage stdlib=stlport

7 在VS2008中设置boost的 包含目录 和 库目录

     包含目录: D:\Library\boost_1_48_0\boost

     库目录: D:\Library\boost_1_48_0\stage\lib

8 完成,测试一下

 测试时在工程属性 c/c++ ->命令行 添加  /D_STLP_DEBUG

或者 在 代码入口中写:

# ifdef _NDEBUG

# undef _STLP_DEBUG

# else

# define _STLP_DEBUG 1

# endif

 

 

 

抱歉!评论已关闭.