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

来源:互联网 发布:c语言求平方根函数 编辑:程序博客网 时间:2024/06/05 03:43

我使用的版本是3.1.0,在编译工程的时候,遇到如下BUG

...CXX/LD -o .build_release/tools/convert_imageset.bin .build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)’ .build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector >&, std::vector > const&)’ .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)’ collect2: error: ld returned 1 exit status make: * [.build_release/tools/convert_imageset.bin] Error 1

...

首先,我是已经配置过了opencv的,可以这样查询安装版本:

$ pkg-config --modversion opencv

因为编译好了,理所当然,输出结果是3.1.0

所以出现上面的错误,应该是opencv_imgcodecs链接的问题,比较有效的解决方案是,把opencv需要的lib添加到Makefile文件中,找到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

阅读全文
0 0
原创粉丝点击