VS2010下安装和使用boost库
2014-03-07 11:09
316 查看
boost官网 http://www.boost.org/
boost sourceforge http://sourceforge.net/projects/boost/files/
Asio官网 http://think-async.com/
Asio sourceforge http://sourceforge.net/projects/asio/files/
Asio samples https://github.com/mabrarov/asio_samples
1.去官网www.boost.org下载最新的boost,我下载了boost_1_55_0.zip和boost_1_55_0-msvc-10.0-32.exe。前者是纯净的源码,需要用户自己编译;后者是VS2010已编译的,含源码和编译生成的库。
2.这里只讲诉boost_1_55_0-msvc-10.0-32.exe。安装路径不建议放在C盘,例如D:\tmpcode\boost_1_55_0。安装需要3.4GB硬盘空间。
3.设置Windows的环境变量。推荐使用工具Rapid Environment Editor。http://www.rapidee.com/
环境变量,用户变量组,新建变量名:BOOST,变量值:D:\tmpcode\boost_1_55_0
4.修改VS2010的参数,在项目的解决方案那里找到属性页,打开并选择配置属性,选择VC++目录,设置包含目录和库目录,例如我的为:
包含目录$(BOOST);$(IncludePath)
库目录 $(BOOST)\lib32-msvc-10.0;$(LibraryPath)
5.至此设置完毕。如果想自行编译源码boost_1_55_0.zip,请参考文章:
/article/1935303.html
6.运行下面程序,测试
推荐姊妹篇《Linux系统编译boost源码,然后和Qt
Creator配套使用》
boost sourceforge http://sourceforge.net/projects/boost/files/
Asio官网 http://think-async.com/
Asio sourceforge http://sourceforge.net/projects/asio/files/
Asio samples https://github.com/mabrarov/asio_samples
1.去官网www.boost.org下载最新的boost,我下载了boost_1_55_0.zip和boost_1_55_0-msvc-10.0-32.exe。前者是纯净的源码,需要用户自己编译;后者是VS2010已编译的,含源码和编译生成的库。
2.这里只讲诉boost_1_55_0-msvc-10.0-32.exe。安装路径不建议放在C盘,例如D:\tmpcode\boost_1_55_0。安装需要3.4GB硬盘空间。
3.设置Windows的环境变量。推荐使用工具Rapid Environment Editor。http://www.rapidee.com/
环境变量,用户变量组,新建变量名:BOOST,变量值:D:\tmpcode\boost_1_55_0
4.修改VS2010的参数,在项目的解决方案那里找到属性页,打开并选择配置属性,选择VC++目录,设置包含目录和库目录,例如我的为:
包含目录$(BOOST);$(IncludePath)
库目录 $(BOOST)\lib32-msvc-10.0;$(LibraryPath)
5.至此设置完毕。如果想自行编译源码boost_1_55_0.zip,请参考文章:
/article/1935303.html
6.运行下面程序,测试
#include "stdafx.h"
#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;
}
推荐姊妹篇《Linux系统编译boost源码,然后和Qt
Creator配套使用》
相关文章推荐
- 开始使用 vs 2010--安装WebDeployment
- VS2013中安装配置和使用Boost库
- VS2010下安装boost库
- MSDN Library for vs 2010安装及使用(MSDN Library)
- VS2013中安装配置和使用Boost库
- 20160225 VS2013中安装配置和使用Boost库
- VS2013中安装配置和使用Boost库
- XP 安装后使用vc2010,进入类视图后,点击一个函数,后vs报错退出问题
- VS2013中安装配置和使用Boost库
- VS2013中安装配置和使用Boost库
- VS2013中安装配置和使用Boost库
- VS2013安装配置和使用Boost库教程
- VS2010下使用boost库详细步骤(保证可用)
- vs打包后生成的安装文件每次执行都需要重新安装C++ 2010运行库(x86)的解决方案
- Boost库的安装使用(Ubuntu)
- VS2010 Express 使用小知识
- VS2008下直接安装使用Boost库1.46.1版本
- delphi2010安装使用技巧(更新帖)
- 如何使用VS 2010进行远程调试:Attach
- SQL SERVER 2010 安装使用技巧(更新帖)