Chinaunix首页 | 论坛 | 博客
  • 博客访问: 142718
  • 博文数量: 24
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 291
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-01 09:36
文章分类

全部博文(24)

文章存档

2010年(4)

2009年(13)

2008年(7)

我的朋友

分类: LINUX

2009-04-16 11:46:05

解压boost到/root/icas/boost/boost_1_38_0下,拷贝bjam到此文件夹,
注: 词句的prefix选项没起到作用,/usr/include下没有创建boost文件夹,待查!
[root@localhost boost_1_38_0]# ./bjam --prefix=/usr/include --with-system --with-thread --with-date_time --with-regex --with-serialization stage

创建timer.cpp:
#include
#include
#include

int main()
{
  boost::asio::io_service io;

    boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
      t.wait();

        std::cout << "Hello, world!\n";

          return 0;
}

[root@localhost tmp]# g++ -I /root/icas/boost/boost_1_38_0 timer.cpp -L/root/icas/boost/boost_1_38_0/stage/lib/ -lboost_system-gcc41-mt-1_38 -lboost_thread-gcc41-mt-1_38
[root@localhost tmp]# ./a.out
./a.out: error while loading shared libraries: libboost_system-gcc41-mt-1_38.so.1.38.0: cannot open shared object file: No such file or directory
说明未设置环境变量
[root@localhost tmp]# LD_LIBRARY_PATH=/root/icas/boost/boost_1_38_0/stage/lib
[root@localhost tmp]# export LD_LIBRARY_PATH
[root@localhost tmp]# ./a.out
Hello, world!
[root@localhost tmp]# 

TODO: 将编译好的lib以及boost头文件都放到/usr/include/boost目录下,避免每次编译都输入路径
阅读(1908) | 评论(0) | 转发(0) |
0

上一篇:[转载]Linux下PCI设备驱动开发

下一篇:tmp

给主人留下些什么吧!~~