OPENCV = 1的YOLO编译失败

时间:2018-02-04 17:52:29

标签: opencv opencv3.0 darknet

我正在使用make文件跟踪YOLO指令,以便使用OPENCV = 1

进行编译
GPU=1
CUDNN=0
OPENCV=1
OPENMP=0
DEBUG=0

在使用CUDA8.0和CUDNN6的Ubuntu 16.04 PC上尝试使用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`

其他信息:我的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'`

` 有任何解决这个问题的建议吗?

1 个答案:

答案 0 :(得分:4)

open" /usr/local/include/opencv2/highgui/highgui_c.h"文件并注释掉第139行:

{{1}}