常见错误:
出现错误1、
C4996’localtime’: This function or variable may be unsafe
1
在yolov5.cpp第一行添加
#pragma warning(disable:4996)
1
出现错误2、
Serialization Error in nvinfer1::rt::CoreReadArchive::verifyHeader: 0 (Magic tag does not match)
是.engine文件有问题。可能你用的是其他版本TensorRT转换的模型导致的。需要你像我刚才说的 修改命令参数为-s yolov5s.wts yolov5s.engine s重新转换一下模型,再修改命令参数为-d yolov5s.engine …/samples来推导图片。
出现错误3、
const char类型的值不能用于初始化char
解决方法:
项目->属性->C/C+±>语言->符合模式,将原来的“是”改为“否”
出现错误4、
无法打开包括文件: “dirent.h”
解决方法:
将dirent.h放在工程目录下,但是我还是识别不了,于是在 项目——yolov5_Trt属性——VC++目录——包含目录 下添加我的工程目录。
“dirent.h”代码放在文章最后。
出现错误5、(只出现在Debug模式下)
错误 LNK2019 无法解析的外部符号 "public: void __cdecl cv::Mat::copyTo(class cv::debug_build_guard::_OutputArray const &)const " (?copyTo@Mat@cv@@QEBAXAEBV_OutputArray@d