VS2010下安装boost库

来源:互联网 发布:开源网络行为管理 编辑:程序博客网 时间:2024/05/17 02:01

转载:http://blog.csdn.net/tzhangofseu/article/details/6526818

1.去www.boost.org下载最新的boost,我下载了boost_1_46_1.7z

2.(我放在D:/cpp目录下)解压到当前文件夹

3.打开VS2010->VS TOOLS->VS命令提示

4.CD D:/cpp/boost_1_46_1 

5.输入bootstrap,便生成bjam.exe文件

6.输入bjam toolset=msvc-10.0 variant=debug,release threading=multi link=static,便生成boost库(时间挺长20分钟以上)

7.修改VS2010的参数 在项目的组合显示那找到属性页,打开属性页,选择配置属性,选择VC++目录,设置includepath和libpath,

如我的为D:/cpp/boost_1_46_1;$(IncludePath)

D:/cpp/boost_1_46_1/stage/lib;$(LibraryPath)

 

 

至此设置完毕

 

运行下面程序

[cpp] view plain copy
print?
  1. #include <boost/config.hpp>  
  2. #include <iostream>  
  3. #include <vector>  
  4. #include <string>  
  5. #include <boost/graph/adjacency_list.hpp>  
  6. #include <boost/tuple/tuple.hpp>  
  7. enum family  
  8. { Jeanie, Debbie, Rick, John, Amanda, Margaret, Benjamin, N };  
  9. int main()  
  10. {  
  11.     using namespace boost;  
  12.     const char *name[] = { “Jeanie”“Debbie”“Rick”“John”“Amanda”,  
  13.         ”Margaret”“Benjamin”  
  14.     };  
  15.   
  16.     adjacency_list <> g(N);  
  17.     add_edge(Jeanie, Debbie, g);  
  18.     add_edge(Jeanie, Rick, g);  
  19.     add_edge(Jeanie, John, g);  
  20.     add_edge(Debbie, Amanda, g);  
  21.     add_edge(Rick, Margaret, g);  
  22.     add_edge(John, Benjamin, g);  
  23.   
  24.     graph_traits < adjacency_list <> >::vertex_iterator i, end;  
  25.     graph_traits < adjacency_list <> >::adjacency_iterator ai, a_end;  
  26.     property_map < adjacency_list <>, vertex_index_t >::type  
  27.         index_map = get(vertex_index, g);  
  28.   
  29.     for (boost::tie(i, end) = vertices(g); i != end; ++i) {  
  30.         std::cout << name[get(index_map, *i)];  
  31.         boost::tie(ai, a_end) = adjacent_vertices(*i, g);  
  32.         if (ai == a_end)  
  33.             std::cout << ” has no children”;  
  34.         else  
  35.             std::cout << ” is the parent of ”;  
  36.         for (; ai != a_end; ++ai) {  
  37.             std::cout << name[get(index_map, *ai)];  
  38.             if (boost::next(ai) != a_end)  
  39.                 std::cout << ”, ”;  
  40.         }  
  41.         std::cout << std::endl;  
  42.     }  
  43.     return EXIT_SUCCESS;  
  44. }  
#include <boost/config.hpp>include <iostream> #include <vector> #include <string> #include <boost/graph/adjacency_list.hpp> #include <boost/tuple/tuple.hpp>enum family{ Jeanie, Debbie, Rick, John, Amanda, Margaret, Benjamin, N };int main(){ using namespace boost; const char *name[] = { “Jeanie”, “Debbie”, “Rick”, “John”, “Amanda”, “Margaret”, “Benjamin” }; adjacency_list <> g(N); add_edge(Jeanie, Debbie, g); add_edge(Jeanie, Rick, g); add_edge(Jeanie, John, g); add_edge(Debbie, Amanda, g); add_edge(Rick, Margaret, g); add_edge(John, Benjamin, g); graph_traits < adjacency_list <> >::vertex_iterator i, end; graph_traits < adjacency_list <> >::adjacency_iterator ai, a_end; property_map < adjacency_list <>, vertex_index_t >::type index_map = get(vertex_index, g); for (boost::tie(i, end) = vertices(g); i != end; ++i) { std::cout << name[get(index_map, *i)]; boost::tie(ai, a_end) = adjacent_vertices(*i, g); if (ai == a_end) std::cout << ” has no children”; else std::cout << ” is the parent of “; for (; ai != a_end; ++ai) { std::cout << name[get(index_map, *ai)]; if (boost::next(ai) != a_end) std::cout << “, “; } std::cout << std::endl; } return EXIT_SUCCESS;}

 

 

阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 即使只要还造句怎么造 只要长得可爱即使是也喜欢吗 超能高中生们即使在异界 即兴 即兴演讲 即兴歌词 即兴说唱 即兴评述 即兴吉他谱 即兴歌曲 即兴表演 即兴发挥 春行即兴 幻想即兴曲 即兴英文 即兴简谱 即兴之作 钢琴即兴 即兴读音 即兴钢琴谱 即兴演讲稿 即兴发挥by林萨 即兴评述题目 即兴演讲题目 即兴演讲技巧 即兴发挥林萨 三分钟即兴幽默演讲稿 即兴说唱英文 即兴表演英文 即兴评述范文 即兴演讲范文 3分钟即兴演讲套话 即兴口语表达 即兴表演小节目 即兴表演节目 即兴歌词小咪 钢琴即兴伴奏速成 钢琴即兴伴奏 英语即兴演讲 即兴在线试听 3分钟即兴演讲范文