c++visual-c++visual-studio-2012warnings

How to use _CRT_SECURE_NO_WARNINGS


I have a compile error in my simple MFC window application generated from wizard with several lines of code:

error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

I set Configuration Properties>>C/C++>>Preprocessor>>Preprocessor Definitions>> _CRT_NONSTDC_NO_WARNINGS

But this doesn't help. I have another very close project that generates only warning in this place and it has no _CRT_NONSTDC_NO_WARNINGS definition.

The only difference between the projects is several different options in wizard.

Why does _CRT_NONSTDC_NO_WARNINGS not help in the first project and why does the second project compile without problems without this definition?


Solution

  • Add by

    Configuration Properties>>C/C++>>Preporocessor>>Preprocessor Definitions>> _CRT_SECURE_NO_WARNINGS

    screenshot of the relevant config interface