操作系统:WSL2下的Ubuntu 22.04.3 LTS
按教程安装了armadillo,然后编译运行它example下带的程序出错:
./main: error while loading shared libraries: libarmadillo.so.9: cannot open shared object file: No such file or directory
找不到动态链接库
使用locate找一下(locate需要安装):
locate libarmadillo.so.9
在/usr/local/lib/下发现该文件,说明armadillo的安装是没问题的。
破案了,我的wsl2 ubuntu`是新弄的,/usr/local/lib/还没添加到系统的搜索路径中。
在/home/用户/.bashrc中添加:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
再source /home/zbbijy/.bashrc就可了~
参考:
已解决:动态库加载失败:cannot open shared object file: No such file or directory-CSDN博客