environment:
ubuntu18.04
opencv3.4.4
cuda10.2+cudnn7.6.5gcc -Iinclude/ -Isrc/ -DOPENCV pkg-config --cflags opencv
-DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -c ./src/data.c -o obj/data.o
In file included from /usr/local/include/opencv2/core/core_c.h:48:0,
from /usr/local/include/opencv2/highgui/highgui_c.h:45,
from ./src/data.c:11:
/usr/local/include/opencv2/core/types_c.h: In function ‘cvIplImage’:
/usr/local/include/opencv2/core/types_c.h:370:12: error: incompatible types when returning type ‘int’ but ‘IplImage {aka struct _IplImage}’ was expected
return _IplImage();
^~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
Makefile:95: recipe for target 'obj/data.o' failed
make: *** [obj/data.o] Error 1
解决办法:
/usr/local/include/opencv2/core/types_c.h:370:12: error: incompatible types when returning type ‘int’ but ‘IplImage {aka struct _IplImage}’ was expected return _IplImage(); 解决:cd /usr/local/include/opencv2/core,sudo gedit types_c.h,注释掉:
/*CV_INLINE IplImage cvIplImage() { #if !defined(CV__ENABLE_C_API_CTORS) IplImage self = CV_STRUCT_INITIALIZER; self.nSize = sizeof(IplImage); return self; #else return _IplImage(); #endif }*/
编译完成后在把注释取消,经过测试,取消后不影响使用