5

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.

Tiasn
  • 185
  • 2
  • 2
  • 8
  • 1
    Right click on Project-> select Properties. In the Property pages go to C/C++-> Preprocessor -> add _CRT_SECURE_NO_WARNINGS to the preprocessor definitions. – David Rinck Oct 10 '15 at 19:50

1 Answers1

16

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

Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
Roger Rowland
  • 25,885
  • 11
  • 72
  • 113