刚配置完环境html
http://www.javashuo.com/article/p-vypvgogc-o.htmlgit
能正常跑原版 darknet ,可是跑了一下别人修改的版本出现了错误github
查Google以后才发现遇到这个问题的朋友不在少数,大概的缘由是由于OpenCV 3.4.1在C的API里有bug,因此致使了这个编译问题。那么我将国外大神的办法转到这里,但愿可以帮助你们解决这个问题,原帖地址在这,也衷心感谢这位国外大神。ui
步骤有两步,须要修改两个c文件。spa
第一步,找到:code
/usr/local/include/opencv2/core/cvdef.h
修改485行左右的代码:htm
#else #include <stdint.h> namespace cv { typedef ::int8_t int8_t; typedef ::uint8_t uint8_t; typedef ::int16_t int16_t; typedef ::uint16_t uint16_t; typedef ::int32_t int32_t; typedef ::uint32_t uint32_t; typedef ::int64_t int64_t; typedef ::uint64_t uint64_t; } #endif
把这段代码注释掉,改成:blog
#else #include <stdint.h> //namespace cv { //typedef ::int8_t int8_t; //typedef ::uint8_t uint8_t; //typedef ::int16_t int16_t; //typedef ::uint16_t uint16_t; //typedef ::int32_t int32_t; //typedef ::uint32_t uint32_t; //typedef ::int64_t int64_t; //typedef ::uint64_t uint64_t; //} #endif
第二步,找到:get
/usr/local/include/opencv2/highgui/highgui_c.h
修改139行左右的代码:it
CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
修改类型为:
CVAPI(CvRect)cvGetWindowImageRect(const char* name);
这两步作完之后,再在darknet文件夹下执行make命令,应该就能编译经过了。编译经过之后别忘了把修改过的代码改回来,由于不知道之后何时万一还会用到,到时候忘了本身改过这里的话会很麻烦。
参考