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)'.


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

 

相关文章
|
8月前
|
Go
go string to int 字符串与整数型的互换
go string to int 字符串与整数型的互换
39 0
|
2月前
|
小程序 前端开发 API
【微信小程序】TypeError: Cannot read property ‘get‘ of undefined & Error: MiniProgramError
【微信小程序】TypeError: Cannot read property ‘get‘ of undefined & Error: MiniProgramError
|
7天前
|
Java UED
Java中String强转int:一种常见的错误和解决方法
在Java中将非数字字符串转换为整数会导致`NumberFormatException`。要解决这个问题,可以使用`try-catch`捕获异常,正则表达式验证数字格式,或利用异常信息提供错误提示。例如,`Integer.parseInt()`会因遇到非数字字符如`&quot;123abc&quot;`而抛出异常,但通过异常处理或正则`\\d+`可确保安全转换。记得在编程时避免直接强转,以防止程序异常中断。
|
2月前
|
资源调度 前端开发
编译第三方前端项目时候出现Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent‘)
编译第三方前端项目时候出现Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent‘)
116 0
|
10天前
|
Java
String转化为Int
String转化为Int
|
2月前
channelSftp.put(InputStream src, String dst, int mode);里的mode都是什么类型的
【5月更文挑战第15天】channelSftp.put(InputStream src, String dst, int mode);里的mode都是什么类型的
52 2
|
2月前
int 和 String 互相转换的多种方法
int 和 String 互相转换的多种方法
16 1
|
2月前
|
C++
【C++】std::string 转换成非const类型 char* 的三种方法记录
【C++】std::string 转换成非const类型 char* 的三种方法记录
28 0
|
7月前
Uncaught runtime errors: × ERROR Cannot read properties of undefined (reading ‘ vue2&vue-router兼容性问题
Uncaught runtime errors: × ERROR Cannot read properties of undefined (reading ‘ vue2&vue-router兼容性问题
225 0
|
8月前
Fatal error: Call to undefined function openssl_pkey_get_private()
Fatal error: Call to undefined function openssl_pkey_get_private()
43 0

热门文章

最新文章