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

 

时间: 2024-09-02 14:31:53

caffe: compile error : undefined reference to `cv::imread(cv::String const&, int)&#39; et al.的相关文章

ndk jni c++ android-NDK开发的时候遇到error: undefined reference to 错误

问题描述 NDK开发的时候遇到error: undefined reference to 错误 大家好,我在正在将C++的一些代码通过ndk调用到android项目里面去,但是在出现了一个很奇怪的错误; /bin/ld: ./obj/local/armeabi/objs/TestNDK2/TestNDK2.o: in function Java_com_example_testndk2_MainActivity_stringTestNdk(_JNIEnv*, _jobject*):jni/Tes

caffe: compile error: Could not open or find file your path~~/resized_data/0 and a total of 2 images .

I0219 14:48:40.965386 31108 net.cpp:76] Memory required for data: 0I0219 14:48:40.965517 31108 layer_factory.hpp:76] Creating layer dataI0219 14:48:40.965621 31108 net.cpp:110] Creating Layer dataI0219 14:48:40.965642 31108 net.cpp:433] data -> dataI

apache 编译报错:undefined reference to `apr_array_clear&#039;

apache 编译报错: modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange': byterange_filter.c:(.text+0x1201): undefined reference to `apr_array_clear' collect2: ld returned 1 exit status make[1]: *** [httpd] Error 1 make[1]: L

undefined reference to `SetPduPowerConsumptionCnt&#039;&#039;错误的解决方法

编译时出现undefined reference to `SetPduPowerConsumptionCnt'错误要如何解决呢?有没有什么好的解决方法?下面小编就为大家解答吧,如果你也遇到了这种情况,可以过来参考下   问题:程序模型用C++语言编写,在程序模型和调用函数之间添加了一个接口文件modelc.cpp,用来让用c语言程序调用程序模型中的函数: 新添加了两个函数setPduPowerConsumptionCnt()和setPduPowerConsumptionTot(),用来清除PDU

类模板使用时遇到undefined reference to的错误

问题描述 类模板使用时遇到undefined reference to的错误 #include using namespace std; const int Max=20; template class stack { private: T s[Max]; int index; public: int getindex() { return index; } void push(T a) { s[index]=a; index ++; } T pop(){ return s[index--];

undefined reference to libiconv_open ext/iconv/.libs/iconv.o by install phpsource

错误信息:ext/iconv/.libs/iconv.o(.text+0x30e2): In function `php_iconv_stream_filter_factory_create':/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2419: undefined reference to `libiconv_open'collect2: ld returned 1 exit statusmake: *** [sapi/cli/

wpa_supplicant编译时出现 undefined reference to `sha256_vector&amp;amp;#39;

问题描述 wpa_supplicant编译时出现 undefined reference to `sha256_vector' CC ../src/drivers/drivers.c CC ../src/l2_packet/l2_packet_linux.c ../src/wps/wps_common.o: In function wps_derive_keys': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../sr

undefined reference to XXX 问题原因

原文地址:http://blog.csdn.net/cserchen/article/details/5503556 Linux下编译程序时,经常会遇到"undefined reference to XXX" 报错, 这里总结一些可能的原因和解决方案,给需要的朋友:   说道undefined reference error,先提一下Linux gcc链接规则:   链接的时候查找顺序是:   -L 指定的路径, 从左到右依次查找由 环境变量 LIBRARY_PATH 指定的路径,使用

执行安装watchman报错undefined reference to __sync_add_and_fetch_4

/app/watchman-2.9.5/./watchman.h:104: undefined reference to `__sync_add_and_fetch_4' /app/watchman-2.9.5/./watchman.h:104: undefined reference to `__sync_add_and_fetch_4' watchman-root.o: In function `w_root_init': /app/watchman-2.9.5/root.c:191: un