cocos2dx——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++)
或者: for(size_t int j=0;j<detector.size();j++) 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章