警告warningC4018有符号/无符号不匹配

C++警告 

warning C4018: “<”: 有符号/无符号不匹配   

警告代码如下:

		for (int i = 0; i<matchePoints.size(); i++)
		{
			imagePoints1.push_back(keypoints1[matchePoints[i].Idx1].pt);
			imagePoints2.push_back(keypoints2[matchePoints[i].Idx2].pt);
		}

错误原因:

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

修改方法:将i改为unsigned int 类型即可。

猜你喜欢

转载自blog.csdn.net/wangyang20170901/article/details/80061472
今日推荐