Compiling issues with boost

前提是你 提交于 2019-12-06 05:55:40

You need to tell the linker where to find the library it needs. I prefer RPATH for this:

g++ -I /usr/local/boost_1_55_0 -Wl,-rpath=/usr/local/lib example.cpp -o example -lboost_system -lboost_thread

That bakes /usr/local/lib into the executable so ld can find it later. You can see what ld will load by running ldd example after building. I bet right now it says "not found" and after adding RPATH it will find the library.

Another option is to set /usr/local/lib as a system search path in your /etc/ld.so.conf, but that's quite a bit more heavyweight.

set up LD_LIBRARY_PATH as export LD_LIBRARY_PATH= path to boost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!