VS中一些warning的消除
来源:互联网 发布:html简单小游戏源码 编辑:程序博客网 时间:2024/06/01 12:33
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,即可。
- VS中一些warning的消除
- warning 的消除方法
- CUDA warning C4819的消除
- iOS中warning的一些总结
- 消除VS中对使用不安全函数的error
- 消除“Android NDK: WARNING: APP_PLATFORM”的方法
- 消除“Android NDK: WARNING: APP_PLATFORM”的方法
- 消除“Android NDK: WARNING: APP_PLATFORM”的方法
- VS中解决warning C4819
- 一些常见的warning
- VS关闭没用的warning
- VS warning C4819 的解决方法
- 关于让VS中scanf_s消除
- Windows 盗版WARNING 消除
- 消除JMVC中的warning
- linux make:消除Warning
- 消除unchecked cast Warning
- VS中一些扩展名文件的作用:
- javax.validation.ValidationException: HV000183: Unable to load 'javax.el.ExpressionFactory'
- Android中用到的设计模式
- xcode打包报错:there was an internal api error
- iOS UIWindow,UIApplication类中的属性介绍
- 八大排序算法
- VS中一些warning的消除
- WDF DMA一些概念(2)
- listview中-全选-单选-多选
- c++第五次作业
- Android 网络通信框架Volley简介(Google IO 2013)
- Access Denied: Either the SOM service on the machine is not started or the user attempting this conn
- HDOJ 1021 Fibonacci Again
- 如何创建不可变(Immutable)的Java类或对象
- C++第五次作业