如何解决error C4996: 'fopen'问题

来源:互联网 发布:wpf编程宝典 编辑:程序博客网 时间:2024/05/21 08:45

我们在程序中使用fopen等CRT函数,就会出现一些警告信息,很烦人,如下:

error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.1>f:\program files (x86)\microsoft visual studio 12.0\vc\include\stdio.h(211) : 参见“fopen”的声明<span style="font-family: 'Microsoft YaHei'; white-space: pre-wrap; background-color: rgb(255, 255, 255);">:</span>


CRT函数(C Runtime Library = C运行时间库)函数,是微软公司对C/C++语言的扩展。CRT函数就是标准的C语言函数。例如,printf、scanf、strlen、fopen等函数就属于CRT函数:

快速解决方方案为在预编译头中加入_CRT_SECURE_NO_WARNINGS,具体操作如下:



然后就是编译成功啦大笑

0 0
原创粉丝点击