Error loading shared libraries of boost

前端 未结 3 1291
梦如初夏
梦如初夏 2020-12-11 08:27

I am working on centos. I installed boost version 1.45.0 on my system. The programs are compiled correctly but whenever I type command to see output it gives following error

相关标签:
3条回答
  • 2020-12-11 09:07

    How did you install the boost libraries?

    The problem you're likely having is that the linker can not find the libraries, and when you built your program, you had to manually specify additional library paths to search for libraries.

    A quick fix you can do is to set LD_LIBRARY_PATH to include the directory where the boost thread library is:

    export LD_LIBRARY_PATH=/path/to/boost/libs:$LD_LIBRARY_PATH

    ./runExecutable

    0 讨论(0)
  • 2020-12-11 09:07

    In addition to the other answers, you can also set the DT_RPATH elf tag when linking your executable

    -Wl,-rpath,/path/to/boost/libraries -L /path/to/boost/libraries -lboost_whatever
    

    This way you don't have to remember to set your LD_LIBRARY_PATH if the libraries are installed in a non-standard location.

    0 讨论(0)
  • 2020-12-11 09:28

    You need to set the LD_LIBRARY_PATH environment variable to include the path to the Boost libraries (they're possibly in /usr/local/lib, etc).

    In bash, this is simply

    export LD_LIBRARY_PATH=/path/to/boost:$LD_LIBRARY_PATH
    
    0 讨论(0)
提交回复
热议问题