我在我的makefile使用它来构建我的程序:链接boost_1_55_0 ASIO
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
当我编译我得到这些警告:
/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
当我运行我的程序,我收到了警告:
./server: error while loading shared libraries: libboost_thread.so.1.53.0: cannot open shared object file: No such file or directory
-Wl/rpath命令此刻不适用于我。我也厌倦了使用
export LD_LIBRARY_PATH=~/boost/lib
我运行了一个程序,我从终端这回前:
export: relocation error: export: symbol errno, version GLIBC_2.0 not defined in file libc.so.6 with link time reference
我能做些什么来指定我想,当我执行程序使用什么库?
有趣的说法。我正在研究这个。谢谢 – hededo
我认为大多数库可以 - 可选地 - 配置为仅适用于Boost的头文件。然后,有** [静态链接](http://www.boost.org/boost-build2/doc/html/bbv2/tutorial/linkage.html)**和[BCP实用程序是提取子集的工具[Boost](http://www.boost.org/doc/libs/1_55_0/tools/bcp/doc/html/index.html)。这两种方法都更适用于海事组织。 – sehe
我不认为阿西欧有这种选择;它取决于升压系统(并可选地增加线程)以获得错误代码。您可以随时在您的项目中包含该cpp。 BCP不是很可靠。根据我的经验,您最终需要修补BCP产生的部分内容。 – ppl