1、warning C4018: “<”: 有符号/无符号不匹配
出错代码:
for(int i = 0; i < AllShapes.size(); i++)
出错原因:AllShapes是一个vector容器, AllShapes.size() 在容器说明中被定义为: unsigned int 类型, 而j是int 类型 所以会出现: 有符号/无符号不匹配警告
错误改正 : 定义j为unsigned 类型后就可以了
即:for(unsigned int i = 0; i < AllShapes.size(); i++)
程序中还有几个类似的warning,也以同样的方法改掉
2、warning C4996: 'mkdir': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _mkdir. See online help for details.
出错代码:mkdir("result");
出错原因,这种声明方式不被造成,应加上_
错误改正:_mkdir("result")
3. warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help
for detail
错误改正:方法一 sprintf->sprintf_s
方法二 更改预处理定义:项目 ->属性 ->配置属性-> c/c++ -> 预处理器 -> 点击预处理器定义->编辑,加入_CRT_SECURE_NO_WARNINGS,即可。