warning C4018有符号无符号不匹配

warning C4018: “<”: 有符号/无符号不匹配
出错代码     for(int j=0;j<detector.size();j++)

出错原因分析:

detector 是一个Vector容器 ,detecot.size() 在容器说明中 被定义为: unsigned int 类型, 而j是int 类型 所以会出现: 有符号/无符号不匹配 警告


错误改正 : 定义j为unsigned 类型后就可以了

即: for(unsigned int j=0;j<detector.size();j++)

原文地址:https://www.cnblogs.com/yingying0907/p/2648551.html