1. 程式人生 > >.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)’

.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)’

編譯caffe時報錯

.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)’

報錯原因: caffe預設使用opencv2.X版本,但是我的機器上安裝的是opencv 3.2.0

可能的解決方法包括: 1. Makefile.config中pkg-config --modversion opencv取消註釋(親測可用) 2. Makefile.config中OPENCV_VERSION := 3取消註釋(親測可用) 3. Makefile.config中找到LIBRARIES(在PYTHON_LIBRARIES := boost_python python2.7 前一行)並修改為:

LIBRARIES += glog gflags protobuf leveldb snappy \
             lmdb boost_system hdf5_hl hdf5 m \ 
             opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

(未測試)