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

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


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

  1. ...
  2. CXX/LD -o .build_release/examples/siamese/convert_mnist_siamese_data.bin
  3. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  4. .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&)'
  5. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  6. collect2: error: ld returned 1 exit status
  7. make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
  8. make: *** Waiting for unfinished jobs....
  9. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  10. .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&)'
  11. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  12. collect2: error: ld returned 1 exit status
  13. make: *** [.build_release/tools/convert_imageset.bin] Error 1
  14. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  15. .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&)'
  16. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  17. collect2: error: ld returned 1 exit status
  18. make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1
  19. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  20. .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&)'
  21. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  22. collect2: error: ld returned 1 exit status
  23. make: *** [.build_release/tools/compute_image_mean.bin] Error 1
  24. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  25. .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&)'
  26. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  27. collect2: error: ld returned 1 exit status
  28. make: *** [.build_release/tools/caffe.bin] Error 1
  29. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  30. .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&)'
  31. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  32. collect2: error: ld returned 1 exit status
  33. make: *** [.build_release/tools/extract_features.bin] Error 1
  34. .build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
  35. .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&)'
  36. .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
  37. collect2: error: ld returned 1 exit status
  38. make: *** [.build_release/examples/siamese/convert_mnist_siamese_data.bin] Error 1
  39. ...

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

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

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

  1. ifeq ($(USE_OPENCV), 1)
  2. LIBRARIES += opencv_core opencv_highgui opencv_imgproc
  3. ifeq ($(OPENCV_VERSION), 3)
  4. LIBRARIES += opencv_imgcodecs
  5. endif
  6. 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. AJPFX关于VIM的常用快捷键

    Ajax技术的核心是XMLHttpRequest对象(简称XHR),var xhr = new XMLHttpRequest();function createXHR(){if (typeof XML ...

  2. JS权威指南-概述学习

    <script src="/javascripts/application.js" type="text/javascript" charset=&quo ...

  3. ExpandableListView 安卓二级菜单

    ExpandableListView可以显示一个视图垂直滚动显示两级列表中的条目,这不同于列表视图(ListView).ExpandableListView允许有两个层次:一级列表中有二级列表.比如在 ...

  4. 将Android系统源码导入Android studio的方法

    Android源码目录结构如下: |-- Makefile|-- abi (applicationbinary interface,应用程序二进制接口,生成libgabi++.so相关库文件)|-- ...

  5. 简洁js日历控件的使用

    往Web工程添加纯js日历控件 在网上找到了DatePicker.js(http://www.cnblogs.com/shenyixin/archive/2013/03/11/2954156.html ...

  6. Spring MVC系列[1]—— HelloWorld

    1.导入jar包 ioc mvc 复制spring-mvc.xml到src目录下. 2.web.xml <?xml version="1.0" encoding=" ...

  7. (十四)maven之启动tomcat

    前言:在网上找了好几种方法启动web项目.比较好用的是:①在Project Facets勾上Dynamic....,但是这个方法会改变项目结构(把WebContent的东西都弄出来了):②使用jett ...

  8. 迅为4412开发板Linux设备树的镜像烧写和源码简单优化教程

    1 烧写:   烧写和4412默认镜像的烧写类似,使用fastboot. 先更新uboot,用4412默认uboot更新支持设备树的uboot 用支持设备树的uboot烧写. 进入支持设备树的uboo ...

  9. C++基础:虚函数、重载、覆盖、隐藏<转>

    转自:http://www.2cto.com/kf/201404/291772.html 虚函数总是跟多态联系在一起,引入虚函数可以使用基类指针对继承类对象进行操作! 虚函数:继承接口(函数名,参数, ...

  10. Sql Server 自动备份

    1)启动代理服务 服务->Sql server 代理启动 2)设置维护计划 维护计划->设置维护计划向导->修改名称及说明 3)更改计划 4)选择维护任务 5)顺序调整不做解释 6) ...