c - 如何禁用 Visual Studio 2012 的警告?

标签 c visual-studio-2012

我有这个错误:

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.

当我使用其他旧的 C 函数时,会弹出类似的错误。 我的问题是:有没有办法让这些错误像警告一样显示,而不会真正阻止代码编译?

最佳答案

您必须定义_CRT_SECURE_NO_WARNINGS在项目的预处理器设置中,或 #define _CRT_SECURE_NO_WARNINGS在文件的开头使用 fopen() 。或者只是使用 fopen_s()相反。

关于c - 如何禁用 Visual Studio 2012 的警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20359994/

相关文章:

entity-framework - 找不到用于使用 Entity Framework、Visual Studio 2012 添加数据库连接的模板

c - 使用指针查找数组中的偶数

c - 链表的意外行为

C编程: how to fopen a designated file and dynamically allocate its contents into a 2D array?

c++ - 如何使用 std::rel_ops 自动提供比较运算符?

c++ - CppUnitTestFramework 的 CString ToString() 模板重载

Winforms:不是有效的 Win32 应用程序

c# - mvc重复用户验证错误

c - 为什么字符上的 "~"运算符会产生更多字节?

c - 如何保存矩阵索引