使用OPENCV=1的YOLO编译失败。

时间:2021-09-16 07:01:18

I am following YOLO instructions with make file for compilation with OPENCV=1

我将按照YOLO的指示,用OPENCV=1的文件进行编译。

GPU=1
CUDNN=0
OPENCV=1
OPENMP=0
DEBUG=0

I get below error when trying to make with OPENCV=1 on Ubuntu 16.04 PC with CUDA8.0 and CUDNN6

当我在Ubuntu 16.04 PC上使用CUDA8.0和CUDNN6时,我在试图使用OPENCV=1时,会遇到以下错误。

`MYPC:~/darknet$ make
 gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU -c ./src/gemm.c -o obj/gemm.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 include/darknet.h:25,
                 from ./src/utils.h:5,
                 from ./src/gemm.c:2:
/usr/local/include/opencv2/highgui/highgui_c.h:139:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
 CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
 ^
compilation terminated due to -Wfatal-errors.
Makefile:85: recipe for target 'obj/gemm.o' failed
make: *** [obj/gemm.o] Error 1`

Additional information: My opencv installation is in home directory with folder name "opencv"

附加信息:我的opencv安装在主目录中,文件夹名称为“opencv”

`$ python
 Python 3.5.4 |Anaconda 4.2.0 (64-bit)| (default, Nov 20 2017, 18:44:38) 
 [GCC 7.2.0] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> 
 >>> import cv2
 >>> cv2.__version__
 '3.4.0'`

` Any suggestions for resolving this ?

“有什么解决办法吗?”

1 个解决方案

#1


3  

open "/usr/local/include/opencv2/highgui/highgui_c.h" file and comment out line 139 :

打开“/ usr /地方/ include / opencv2 / highgui / highgui_c。h"文件和注释第139行:

//CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);

#1


3  

open "/usr/local/include/opencv2/highgui/highgui_c.h" file and comment out line 139 :

打开“/ usr /地方/ include / opencv2 / highgui / highgui_c。h"文件和注释第139行:

//CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);