本系列文章由 @yhl_leo 出品,转载请注明出处。

文章链接: http://blog.csdn.net/yhl_leo/article/details/52150781


整理之前编译工程中遇到的一个Bug,贴上提示log信息:

...

CXX/LD -o .build_release/examples/siamese/convert_mnist_siamese_data.bin
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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/upgrade_net_proto_text.bin] Error 1
make: *** Waiting for unfinished jobs....
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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/upgrade_net_proto_binary.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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/compute_image_mean.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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/caffe.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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/extract_features.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > 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/examples/siamese/convert_mnist_siamese_data.bin] Error 1 ...

很明显是OpenCV出了问题,网上查阅后,得知是因为lib文件opencv_imgcodecsMakefile文件中未添加,修改如下:

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

此外,还有一些Makefile文件这么写,也是可行的:

ifeq ($(USE_OPENCV), 1)
LIBRARIES += opencv_core opencv_highgui opencv_imgproc ifeq ($(OPENCV_VERSION), 3)
LIBRARIES += opencv_imgcodecs
endif endif

Caffe 编译: undefined reference to imencode()的更多相关文章

  1. PHP无法编译undefined reference to `libiconv_open

    ./configure --prefix=/usr/local/php52 make时提示:.....................................................e ...

  2. (笔记)Linux线程编译undefined reference to 'pthread_create'

    在使用线程时,使用gcc或arm-linux-gcc编译时,会出现错误:undefined reference to 'pthread_create' 主要是以下两种原因: 1.#include &l ...

  3. PHP7编译错误:php编译undefined reference to `libiconv 错误

    ext/gd/libgd/.libs/gdkanji.o: In function `do_convert’: /root/php-5.2.12/ext/gd/libgd/gdkanji.c:350: ...

  4. [caffe error] undefined reference to `inflateValidate@ZLIB_1.2.9'

    undefined reference to `inflateValidate@ZLIB_1.2.9' Makefile.config添加一行LINKFLAGS := -Wl,-rpath,$(HOM ...

  5. codeBlocks编译undefined reference to错误

    是没有把c文件编译进去的原因. 右键项目,选择属性,弹出窗体 然后选择build targets 在最下面有个build target files:中把c文件勾选.点击ok重新编译即可. Code:: ...

  6. 「caffe编译bug」.build_release/lib/libcaffe.so: undefined reference to cv::imread

    转自:https://www.douban.com/note/568788483/ CXX/LD -o .build_release/tools/convert_imageset.bin.build_ ...

  7. undefined reference to cv::imread(cv::String const&, int)

    .build_release/lib/libcaffe-nv.so: undefined reference to cv::imread(cv::String const&, int)' .b ...

  8. (原)编译caffe时提示未定义的引用(undefined reference to)

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5864715.html 参考网址: https://github.com/BVLC/caffe/issu ...

  9. caffe编译时候出现 undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0'

    1.编译时候出现 make: * [.build_release/examples/siamese/convert_mnist_siamese_data.bin] Error 1 /usr/local ...

随机推荐

  1. jQuery源码分析系列(转载来源Aaron.)

    声明:非本文原创文章,转载来源原文链接Aaron. 版本截止到2013.8.24 jQuery官方发布最新的的2.0.3为准 附上每一章的源码注释分析 :https://github.com/JsAa ...

  2. JSP界面设置提示浮动框

    1.公共js <script type="text/javascript"> var tip={ $:function(ele){ if(typeof(ele)==&q ...

  3. Android - CollapsingToolbarLayout 完全解析

    CollapsingToolbarLayout 是 google 在其推出的design libiary 中给出的一个新型控件.其可以实现的效果类似于: toolbar是透明的,有一个背景图片以及大标 ...

  4. K-means、KNN学习笔记

    1.K-means:聚类算法,无监督 输入:k, data[n]; (1) 选择k个初始中心点,例如c[0]=data[0],…c[k-1]=data[k-1]; (2) 对于data[0]….dat ...

  5. 按Home键切换到后台后会触发libGPUSupportMercury.dylib: gpus_ReturnNotPermittedKillClient导致crash

    转自:http://www.eoeandroid.com/thread-251598-1-1.html 好像有很多朋友都碰到过这个问题,即在真机调试时,按hone键返回桌面,再回到app时,app会c ...

  6. Python 目录和文件基本操作

    今天在写一个小工具的过程中发现对目录和文件的基本操作不是很熟,特此把遇到的常用操作总结汇总下. 获取当前路径:os.getcwd() 目录操作:1.创建目录:os.mkdir('目录名')2.创建多级 ...

  7. 根据HTML语义化编码

    语义化标签——http://www.html5jscss.com/html5-semantics-section.html 写HTML代码时应注意什么? 尽可能少的使用无语义的标签div和span: ...

  8. WPF使用附加属性绑定,解决data grid列绑定不上的问题

    背景 需要对datagrid的列header添加自定义属性,然后绑定,并根据不同的列header绑定不同的值,传统的加扩展类太麻烦,而附加属性的特点更适用于这种场景. 1.xaml 代码 <Da ...

  9. springboot上传linux文件无法浏览,提示404错误

    1.配置文件地址置换 @Componentclass WebConfigurer implements WebMvcConfigurer { @Autowired ConfigUtil bootdoC ...

  10. UIViewAnimationOptions

    常规动画属性设置(可以同时选择多个进行设置) UIViewAnimationOptionLayoutSubviews:执行UIView动画时,自动更新Subview的Layout约束.. UIView ...