Cannot find boost library
This is a very basic question, I only post because I've spent already some time into it. This is what I've done so far:
Downloaded and compiled the boost library:
sudo ./bootstrap.shandsudo ./bjam installThis way it was installed into
/usr/local/lib.In my source code I've added only:
#include <boost/asio.hpp> using boost::asio::ip::tcpI compile it with:
g++ -I/usr/lib/jvm/java-6-openjdk/include -L/usr/local/lib -fPIC -lboost_system -shared -o libagent.so agent.cppHowever,
ldd -d ./libagent.sogives me:libboost_system.so.1.46.1 => not foundBut there is no error thrown, when using the
-lboost_systemandls /usr/local/libgets me among other things:
开发者_运维百科libboost_system.solibboost_system.a
What am I missing?
Did the ./bjam install tool also run the ldconfig(8) tool? ldconfig(8) needs to be run after new libraries are installed to update the caches used by ld.so(8) at program execution time.
You should compile it with:
g++ -I/usr/lib/jvm/java-6-openjdk/include -L/usr/local/lib -Wl,-rpath,/usr/local/lib -fPIC -lboost_system -shared -o libagent.so agent.cpp
This makes it look for the boost library in /usr/local/lib at runtime, the -L option only makes it look in /usr/local/lib at compile time.
加载中,请稍侯......
精彩评论