下载

    进入http://www.boost.org/,下载最新的源码包,我用的版本是1.55.0。

 

解压

    将其解压,我的解压目录是“D:\Program\open\boost_1_55_0”。

 

编译

  • 打开VS2008,选择“Tools”(工具)->“Visual Studio 2008 command prompt”(命令提示),进入命令行界面。
  • 进入到“D:\Program\open\boost_1_55_0”,执行“bootstrap.bat”进行引导。
  • 引导成功之后在相同目录下会生成bjam.exe。执行如下命令进行编译:

     bjam stage --toolset=msvc-9.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-python --without-serialization --without-wave --stagedir="D:\Program\open\boost_1_55_0\bin\vc9" link=static runtime-link=shared runtime-link=static threading=multi debug release

     注:编译需要点时间,可以喝杯茶抖抖腿。:)

 

配置VS2008

    选择“Tools”(工具)->“Options”(选项)->“Projects and solutions”(项目和解决方案)->“VC ++ directories”(VC++目录)。

     配置Include包含文件)目录如下:

[C++] VS2008下Boost库的编译安装

 

    配置Library库文件)目录如下:

[C++] VS2008下Boost库的编译安装

 

测试

 1 #include <iostream>
 2 #include <boost/thread/thread.hpp>
 3 
 4 using namespace std;
 5 
 6 void printBook()   
 7 {   
 8     cout << "1984 - George Orwell" << endl;
 9 }
10 
11 int main()
12 {   
13     boost::thread myThread(&printBook);
14     myThread.join();
15 
16     return 0;
17 }

 

参考

 

 (完)

相关文章:

  • 2021-10-07
  • 2022-01-22
  • 2021-09-28
  • 2021-11-12
  • 2022-02-04
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2021-09-19
  • 2021-08-27
  • 2021-09-05
相关资源
相似解决方案