./test:错误而载入共享库:libcpprest.so.2.8:无法打开共享对象文件:没有这样的文件或目录

问题描述:

我执行以下编译命令行:./test:错误而载入共享库:libcpprest.so.2.8:无法打开共享对象文件:没有这样的文件或目录

g++ -std=c++11 -I/home/admin/Github/casablanca/Release/include -L/home/admin/Github/casablanca/Release/build.debug/Binaries test.cc -o test -lboost_system -lcrypto -lssl -lcpprest 

编译会成功

admin:$ ls /home/admin/Github/casablanca/Release/build.debug/Binaries/libcpprest.so* 
/home/admin/Github/casablanca/Release/build.debug/Binaries/libcpprest.so 
/home/admin/Github/casablanca/Release/build.debug/Binaries/libcpprest.so.2.8 

./test: error while loading shared libraries: libcpprest.so.2.8: cannot open shared object file: No such file or directory 

尽管文件libcpprest.so.2.8在指定的位置存在:但我在运行时得到这个错误

我将不胜感激任何意见

感谢

我猜是因为路径“/home/admin/Github/casablanca/Release/build.debug/Binaries/”不包含在运行时错误LD_LIBRARY_PATH环境变量。如果您在运行的shell中执行“echo $ LD_LIBRARY_PATH”,它应该确认。