problems linking libraries in debian linux

I followed the instructions in the getting started guide but I am still having troubles with getting the libraries linked. In the guide the way it shows to compile the second program is like this: $ c++ -I path/to/boost_1_35_0 example.cpp -o example \ -L~/boost/lib/ -lboost_regex-gcc34-mt-d-1_35 Here is how I translated that to my system: $ g++ -I /usr/local/include/boost_1_35/ boostTest2.cpp -L/usr/local/lib/ -lboost_regex-gcc41-mt But when I run this I get this error: zach@debian:~/code$ ./a.out < jayne.txt ./a.out: error while loading shared libraries: libboost_regex-gcc41-mt-1_35.so.1.35.0: cannot open shared object file: No such file or directory This file does exist, here is the listing of my /usr/local/lib directory: libboost_date_time-gcc41-mt-1_35.so libboost_date_time-gcc41-mt-1_35.so.1.35.0 libboost_date_time-gcc41-mt.so libboost_filesystem-gcc41-mt-1_35.so libboost_filesystem-gcc41-mt-1_35.so.1.35.0 libboost_filesystem-gcc41-mt.so libboost_graph-gcc41-mt-1_35.so libboost_graph-gcc41-mt-1_35.so.1.35.0 libboost_graph-gcc41-mt.so libboost_prg_exec_monitor-gcc41-mt-1_35.so libboost_prg_exec_monitor-gcc41-mt-1_35.so.1.35.0 libboost_prg_exec_monitor-gcc41-mt.so libboost_program_options-gcc41-mt-1_35.so libboost_program_options-gcc41-mt-1_35.so.1.35.0 libboost_program_options-gcc41-mt.so libboost_python-gcc41-mt-1_35.so libboost_python-gcc41-mt-1_35.so.1.35.0 libboost_python-gcc41-mt.so libboost_regex-gcc41-mt-1_35.so libboost_regex-gcc41-mt-1_35.so.1.35.0 libboost_regex-gcc41-mt.so libboost_serialization-gcc41-mt-1_35.so libboost_serialization-gcc41-mt-1_35.so.1.35.0 libboost_serialization-gcc41-mt.so libboost_signals-gcc41-mt-1_35.so libboost_signals-gcc41-mt-1_35.so.1.35.0 libboost_signals-gcc41-mt.so libboost_system-gcc41-mt-1_35.so libboost_system-gcc41-mt-1_35.so.1.35.0 libboost_system-gcc41-mt.so libboost_test_exec_monitor-gcc41-mt-1_35.a libboost_test_exec_monitor-gcc41-mt.a libboost_thread-gcc41-mt-1_35.so libboost_thread-gcc41-mt-1_35.so.1.35.0 libboost_thread-gcc41-mt.so libboost_unit_test_framework-gcc41-mt-1_35.so libboost_unit_test_framework-gcc41-mt-1_35.so.1.35.0 libboost_unit_test_framework-gcc41-mt.so libboost_wave-gcc41-mt-1_35.so libboost_wave-gcc41-mt-1_35.so.1.35.0 libboost_wave-gcc41-mt.so libboost_wserialization-gcc41-mt-1_35.so libboost_wserialization-gcc41-mt-1_35.so.1.35.0 libboost_wserialization-gcc41-mt.so libpurple.la libpurple.so libpurple.so.0 libpurple.so.0.4.1 I know this is probably a linux problem and not a boost problem, but I cannot figure it out. Any ideas?

Shutters, Zachary A schrieb:
$ g++ -I /usr/local/include/boost_1_35/ boostTest2.cpp -L/usr/local/lib/ -lboost_regex-gcc41-mt
But when I run this I get this error: zach@debian:~/code$ ./a.out < jayne.txt ./a.out: error while loading shared libraries: libboost_regex-gcc41-mt-1_35.so.1.35.0: cannot open shared object file: No such file or directory
Probably the linker does not search in /usr/local/lib or the libs are not in the cache yet. Try "ldd ~/code/a.out" which shows you the shared libraries the program is linked against and where the linker has found them (or hasn't). You can try setting LD_LIBRARY_PATH: LD_LIBRARY_PATH=/usr/local/lib ldd ~/code/a.out LD_LIBRARY_PATH=/usr/local/lib ~/code/a.out Make sure that /usr/local/lib is included in /etc/ld.so.conf or some file in /etc/ld.so.conf.d/ If it is then you probably have not rebooted since installing boost. You can run ldconfig (as root) to regenerate the linker cache. After that it should work without setting LD_LIBRARY_PATH. Or you could just link to the static libraries: $ g++ -I /usr/local/include/boost_1_35/ boostTest2.cpp -L/usr/local/lib/ -Wl,-Bstatic -lboost_regex-gcc41-mt Regards, Mika
participants (2)
-
Mika Fischer
-
Shutters, Zachary A