Boost logo

Boost Users :

From: Mika Fischer (mika.fischer_at_[hidden])
Date: 2008-04-26 18:13:40


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_at_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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net