Compiler Error: Function call with parameters that may be unsafe
如下的代码:
#include <stdio.h> #include <string> #include <algorithm> #include <cassert> #include <cctype> #include <boost/algorithm/string.hpp> int main(int argc, char *argv[]) { char song[17] = "Book of Taliesyn"; boost::to_upper(song); assert(std::string(song) == "BOOK OF TALIESYN"); return 0; } |
编译的时候报错:
Error 1 error C4996: 'std::_Transform1': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' c:\program files (x86)\microsoft visual studio 12.0\vc\include\algorithm 1026 1 Test13 |
[分析]
- 搜索到如下的文章:
The warning is telling you that you risk a buffer overflow if |
-D is a command line compiler flag which causes the rest of the text to be treated as if there was a #define in your code. In solution explorer, right click the project, select "properties". The project property page will open. Expand the ">C/C++" entry in the tree on the left and select "Preprocessor" under that. The top entry in the right pane should be "Preprocessor Definitions". In that edit box, add _SCL_SECURE_NO_WARNINGS, separating it from the other entries with a ; |
[解决]
加上这个宏定义后,就编译通过了.
Compiler Error: Function call with parameters that may be unsafe的更多相关文章
- VS2013编译程序出现error C4996: 'std::_Fill_n': Function call with parameters that may be unsafe
最近按照BiliBil网站Visual C++网络项目实战视频教程,使用VS2013编写一个基于MFC的对话框程序HttpSourceViewer,采用了WinHttp库.Boost xpressiv ...
- error C4996: Function call with parameters that may be unsafe – this call relies on the caller to ch
在加入QCustomplot时有如题的错误 1>c:\program files (x86)\microsoft visual studio11.0\vc\include\xutility(21 ...
- error C4996: Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct
使用VS13 跟 google protocbuf时出现了这个问题:真蛋疼,用别人的东西你就说不安全,用你自己的东西时你怎么不说不安全来着! 解决方案 在protoc 生成的头文件中加上 #pr ...
- windows下编译caffe出现错误 C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe?
解决方案来自http://blog.csdn.net/u012556077/article/details/50353818
- Alignment And Compiler Error C2719 字节对齐和编译错误C2719
Compiler Error C2719 'parameter': formal parameter with __declspec(align('#')) won't be aligned The ...
- 转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38
转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38http://space.itpub. ...
- idea报错:error java compilation failed internal java compiler error
idea下面报如下问题 error java compilation failed internal java compiler error 解决办法:Setting->Compiler-> ...
- c++ builder 2010 错误 F1004 Internal compiler error at 0x9740d99 with base 0x9
今天遇到一个奇怪的问题,拷贝项目后,在修改,会出现F1004 Internal compiler error at 0x9740d99 with base 0x9 ,不管怎么改,删除改动,都没用,关闭 ...
- Compiler Error Message: CS0016: Could not write to output file 回绝访问
Compiler Error Message: CS0016: Could not write to output file 'c:\Windows...dll' 拒绝访问 C:\Windows\Te ...
随机推荐
- idea配置web项目启动的详细说明
每次用完一个编辑器以后 ,再换另一个编辑器使用 过段时间再回来使用idea,总是会忘记些什么 ,毕竟每个编辑器的风格和结构都有所区别 特此记下笔记 方便以后查看 图片文字看不清的 请在图片上 ...
- 用easy-ui中的表单操作实现一行操作和多行操作
http://blog.sina.com.cn/s/blog_8e50ede90101fff9.html
- There is no setter for property named 可能产生的原因!
There is no setter for property named 'operateIP ' in 'class com.chinaunicom.wsp.facade.entity.User ...
- Nginx 关闭防火墙
关闭防火墙 1) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后失效 开启: service ...
- Snowflake Snow Snowflakes POJ - 3349(hash)
You may have heard that no two snowflakes are alike. Your task is to write a program to determine wh ...
- Codeforces 948D Perfect Security 【01字典树】
<题目链接> 题目大意: 给定两个长度为n的序列,可以改变第二个序列中数的顺序,使得两个序列相同位置的数异或之后得到的新序列的字典序最小. 解题分析: 用01字典树来解决异或最值问题.因为 ...
- APP开发,微信第三方登录的介绍
去年做了一阵APP相关的开发,经常遇到第三方登陆的需求,比如微信.微博.fb的第三方登陆等等,其实主要的流程都大同小异,这里就以微信为例来介绍,希望对大家有帮助. 微信开放平台(open.weixin ...
- [mariadb]Windows Mariadb 10.2安装过程
在学习Flask的过程中,碰到SQLAlchemy不支持Mariadb 10.2.9以前版本的问题,于是升级Mariadb到10.2.10. 升级过程中,我只能说,Mariadb及Mysql的文档结构 ...
- Python datetime与timestamp之间的转换
# !!!! Python 2 datetime.datetime 对象没有timestamp方法! 在用Python处理datetime和timestamp的转换时发现在时区方面,Python的处理 ...
- LeetCode(485. 最大连续1的个数)
问题描述 给定一个二进制数组, 计算其中最大连续1的个数. 示例 1: 输入: [1,1,0,1,1,1] 输出: 3 解释: 开头的两位和最后的三位都是连续1,所以最大连续1的个数是 3. 注意: ...