Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable a warning in Visual Studio 2015 for C? [duplicate]

I am new in programming in C and I'm not used to work in Visual Studio 2015, my professor sent me a source code for a homework, but I'm obtaining the following error:

Error C4996 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

I already looked in the forums of Visual Studio. Nonetheless, I didn't understand how to disable this warning in order to be able to compile the application.

like image 267
Tiasn Avatar asked Oct 10 '15 19:10

Tiasn


People also ask

How do I turn off warnings in Visual Studio?

Suppress specific warnings for Visual C# or F# Or, select the project node and press Alt+Enter. Choose Build, and go to the Errors and warnings subsection. In the Suppress warnings or Suppress specific warnings box, specify the error codes of the warnings that you want to suppress, separated by semicolons.

How do I supress a warning in C#?

Use a #pragma warning (C#) or Disable (Visual Basic) directive to suppress the warning for only a specific line of code.

How do you suppress code analysis?

Right-click the project in Solution Explorer and then click Properties. Choose the Code Analysis tab. Select the Suppress results from generated code check box.

How do I enable warnings in Visual Studio?

If you want to turn it on (or off) in the project setting, you have to go to: Configuration Properties -> C/C++ -> Command Line and then under Additional Options you can enter: /w3#### to set your warning to level 3, and thus enable it; or you can enter /wd#### to disable a warning.


1 Answers

In later versions of Visual Studio, additional security checks are enabled by default on new projects, which makes the warning you see be treated as an error.

So, in addition to the actions in the suggested duplicate questions, you may also need to do the following.

Right click on the project in the solution explorer and choose Properties from the menu, then make sure you turn off SDL checks as shown in the following screenshot:

sdl

UPDATE (This alone worked for me): enter image description here

like image 151
Roger Rowland Avatar answered Sep 25 '22 00:09

Roger Rowland