链接boost_1_55_0 ASIO [英] Linking boost_1_55_0 asio

查看:321
本文介绍了链接boost_1_55_0 ASIO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Makefile使用它来构建我的程序:

I'm using this in my makefile to build my program:

all:    server.cpp
g++ -o server server.cpp -I ~/boost/include -L~/boost/lib -Wl,-rpath,~/boost/lib -lboost_system -lboost_thread -DBOOST_ALL_NO_LIB=1

当我编译我得到这些警告:

When I compile I get these warnings:

/usr/bin/ld: warning: libboost_system.so.1.53.0, needed by /usr/local/lib/libboost_thread.so, may conflict with libboost_system.so.5

当我运行我的程序,我收到了警告:

When I run my program I receive the warning :

 ./server: error while loading shared libraries: libboost_thread.so.1.53.0: cannot open shared object file: No such file or directory

在-Wl / rpath的指令此刻不为我工作。我一直在使用还累

the -Wl/rpath command is not working for me at the moment. I have also tired using

export LD_LIBRARY_PATH=~/boost/lib

在我运行了一个程序,我从这个码头回:

before I run my program and I get this back from the terminal:

export: relocation error: export: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference

我能做些什么来指定我想,当我执行程序使用什么样的图书馆吗?

What can I do to specify what library I want to use when I execute the program?

推荐答案

的库(通常)升压/ lib中/台/ lib目录,而不是升压/ lib目录

The libraries are (usually) boost/lib/stage/lib, not boost/lib.

另外,动态加载程序的不支持扩展。使用完全合格的路径,例如

Also the dynamic loader does not support ~ expansion. Use the fully qualified path, e.g.

 -Wl,-rpath,/home/hededo/boost/stage/lib

或者更确切地说,我表现出我的previous答案

Or, indeed, as I showed in my previous answer

 -Wl,-rpath,"$HOME/boost/stage/lib"

的引号只是为了工作,如果 $ HOME 包含特殊字符(如空格)

The quotes are just to make it work if $HOME contains special characters (like whitespace)

您也可以看看


  • 静态链接 - 这样你就可以使用升压但从来没有依靠任何外部共享库它

  • BCP实用程序是提取升压(这里的子集的工具:的 BCP

  • static linking - so you can use Boost but never rely on any external shared library for it
  • the BCP utility is a tool for extracting subsets of Boost (here: bcp)

这篇关于链接boost_1_55_0 ASIO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆