1.用gedit打开/etc/ld.so.conf
终端输入: sudo gedit /etc/ld.so.conf
文件末行加入:include /usr/loacal/lib
2.然后终端执行指令:
sudo ldconfig
3.接着修改bash.bashrc文件 ,终端输入:
sudo gedit /etc/bash.bashrc
文件末行加入:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
4.最后source一下,让更改立即生效,终端输入:
source /etc/bash.bashrc
5.如果没有正确配置opencv库的环境变量,在编译运行opencv程序时,会出现类似这种的错误提示:
error while loading shared libraries: libopencv_ccalib.so.3.2: cannot open shared object file: No such file or directory
6.如何终端编译opencv程序:
终端输入: g++ 1.cpp -o 1 `pkg-config --cflags --libs opencv`
7.参考资料:
资料