Chinaunix首页 | 论坛 | 博客
  • 博客访问: 623188
  • 博文数量: 116
  • 博客积分: 6078
  • 博客等级: 准将
  • 技术积分: 1214
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-23 10:09
文章分类

全部博文(116)

文章存档

2016年(1)

2015年(4)

2011年(2)

2010年(21)

2009年(88)

分类: C/C++

2009-10-31 21:06:57

lihaoyxj@gmail.com
至于windows上的,我是直接使用下的安装器自动安装的,所以不再阐述,本节中主要说linux下的,我因为遇到了一些问题,故整理一下:
1. boost.org中下载源代码,并解压到/opt/boost_1_40_0下:tar -xvf boost_xxx.tar /opt
2. cd /opt/boost_1_40_0.
3. 可以调用 sh bootstrap.sh 生成bjam,也可以到cd tools/jam/src下运行build.sh. 并将bin.linuxx86下的bjam cp bjam /usr/local/bin 下
4. 可以回到 cd /opt/boost_1_40_0
5. 运行bjam -sTOOLS=gcc install
6. 编辑环境变量
   vim /etc/profile
  BOOST_INCLUDE=/usr/include/boost
 

  BOOST_LIB=/usr/local/lib/
  export BOOST_LIB BOOST_INCLUDE

7. 编辑运行库配置
  vim /etc/ld.so.conf
  新加一行 /usr/local/lib
8. 我要验证boost库中的filesystem的例子
  cd /opt/boost_1_40_0/libs/filesystem/example
  g++ -o simple_ls.out simple_ls.cpp -I$BOOST_INCLUDE -L$BOOST_LIB -lboost_filesystem
  运行 ./simple,OK,列出当前的文件或文件夹列表了
阅读(1720) | 评论(4) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-09-12 21:35:52

小弟初學boost,請問以下問題如何解:)? In file included from /usr/include/boost/exception_ptr.hpp:14, from /usr/include/boost/thread/future.hpp:14, from /usr/include/boost/thread.hpp:24, from t.cpp:4: /usr/include/boost/exception/info.hpp:51: error: prototype for ‘std::string boost::error_info::tag_typeid_name() const’ does not match any in class ‘boost::error_info’ /usr/include/boost/exception/detail/error_info_impl.hpp:54: error: candi

chinaunix网友2010-08-29 17:07:15

bjam --toolset=msvc-8.0 stage --build-type=complete stage

lihao_nx2009-11-27 22:17:28

不是太明白你的意思,作为boost中一部分库是不需要指定它的link的库文件的,但是象filesystem乖几个库需要link它的lib的,我没用过eclipse开发c++,但是在makefile中应是-I$boost_include -Lboost_lib -lfilesystem.lib才可以的

小怪兽O2009-11-27 13:49:46

你好,按照您的方法已经成功运行了,但是如果我需要在eclipse编译使用boost的话,需要将"boost_filesystem"添加至gcc c++ linker才能编译该实例。如果我需要用到库中其它文件的话又要手动添加,请问有没有一劳永逸的设置方法呢?该如何设置gcc c++ linker呢? 期望得到您的回复:maxillusion@live.cn 感谢!