zoukankan      html  css  js  c++  java
  • caffe: compile error : undefined reference to `cv::imread(cv::String const&, int)' et al.


    when I compile caffe file :

    .build_debug/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
    .build_debug/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_debug/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
    collect2: error: ld returned 1 exit status
    .build_debug/lib/make: libcaffe.so: undefined *** [.build_debug/tools/upgrade_net_proto_text.bin] Error 1
    referencemake: *** Waiting for unfinished jobs....
     to `cv.build_debug/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
    .build_debug/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_debug/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::/_InputArray const&, usrint)/bin/'ld:
    warning: libcudart.so.5.5, needed by /usr/local/lib/libopencv_core.so, may conflict withcollect2: error: ld returned 1 exit status
     libcudart.so.7.5
    .build_debug/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
    .build_debug/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::allocatorbuild_debug<int> /> constlib&)'/libcaffe.so
    .build_debug/: lib/undefined referencelibcaffe.so: to make:  `*** [.build_debug/tools/upgrade_net_proto_binary.bin] Error 1cvundefined: :referenceimread
    ( tocv:: `String cvconst&::imdecode, int(cv)'
    .::_InputArraybuild_debug/ const&lib, int/)'
    libcaffe.so: undefined reference to `cv::imencode(cv:collect2: error: ld returned 1 exit status
    :String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
    .build_debug/lib/libcaffe.so: make: undefined reference*** [.build_debug/tools/caffe.bin] Error 1 to
     `cv::imdecode(cv::_InputArray const&, int)'
    ::imread(cv::String const&, int)'
    collect2: error: ld returned 1 exit status
    .build_debug/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_debug/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
    make: *** [.build_debug/tools/extract_features.bin] Error 1collect2: error: ld returned 1 exit status

    make: *** [.build_debug/tools/compute_image_mean.bin] Error 1
    .build_debug/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
    .build_debug/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_debug/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
    collect2: error: ld returned 1 exit status
    make: *** [.build_debug/tools/convert_imageset.bin] Error 1
    wangxiao@wangxiao-GTX980:/media/wangxiao/247317a3-e6b5-45d4-81d1-956930526746/---------------/caffe-master$

    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    Answer: https://github.com/BVLC/caffe/issues/2348
    But if you delete all the file in build(rm -rf ./build/*) before "make all",you will success.I just success
    so, just input the code and make all -j8 again.

    well, same problem... and change the following code in Makefile:
    >>>>>>>>  LIBRARIES += opencv_core opencv_highgui opencv_imgproc
    into :    LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

    yeah, just add the: opencv_imgcodecs  at last.  and it really worked.



    thus, the following steps may needed:

    1. change the Makefile :

      add "opencv_imagecodecs" to the last of LIBRARIES += opencv_core opencv_highgui opencv_imgproc;

    2. remove the files in build :

      rm -rf ./build/*

    3. make all -j8

  • 相关阅读:
    Spring Boot2 系列教程(二)创建 Spring Boot 项目的三种方式
    Spring Boot2 系列教程(一)纯 Java 搭建 SSM 项目
    Python 解析XML实例(xml.sax)
    深度学习Tensorflow相关书籍推荐和PDF下载
    气象netCDF数据可视化分析
    Python 操作MySQL 数据库
    用这个库 3 分钟实现让你满意的表格功能:Bootstrap-Table
    浅谈压缩感知(二十六):压缩感知重构算法之分段弱正交匹配追踪(SWOMP)...
    web开发工具flask中文英文书籍-持续更新
    Python 在气象上的应用
  • 原文地址:https://www.cnblogs.com/wangxiaocvpr/p/5200837.html
Copyright © 2011-2022 走看看