刚配置完环境
能正常跑原版 darknet ,但是跑了一下别人修改的版本出现了错误
查Google之后才发现遇到这个问题的朋友不在少数,大概的原因是因为,所以导致了这个编译问题。那么我将国外大神的办法转到这里,希望能够帮助大家解决这个问题,,也衷心感谢这位国外大神。
步骤有两步,需要修改两个c文件。
第一步,找到:
/usr/local/include/opencv2/core/cvdef.h
修改485行左右的代码:
#else#includenamespace 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
把这段代码注释掉,改为:
#else#include//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
第二步,找到:
/usr/local/include/opencv2/highgui/highgui_c.h
修改139行左右的代码:
CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
修改类型为:
CVAPI(CvRect)cvGetWindowImageRect(const char* name);
这两步做完以后,再在darknet文件夹下执行make命令,应该就能编译通过了。编译通过以后别忘了把修改过的代码改回来,因为不知道以后什么时候万一还会用到,到时候忘了自己改过这里的话会很麻烦。
参考