Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use _CRT_SECURE_NO_WARNINGS

I have 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++>>Preporocessor>>Preprocessor Definitions>> _CRT_NONSTDC_NO_WARNINGS

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

Only difference between projects is several different options in wizard.

Why _CRT_NONSTDC_NO_WARNINGS does not helps in first project and why second project compiles without problems without this definition?

like image 950
vico Avatar asked Mar 17 '14 09:03

vico


People also ask

What is _crt_secure_no_warnings?

_CRT_SECURE_NO_WARNINGS means you don't want the compiler to suggest the secure versions of the library functions, e.g. scanf_s when you use scanf .

How do you use CRT no warnings?

Queries related to “crt secure no warnings”To disable deprecation, use _CRT_SECURE_NO_WARNINGS. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.


1 Answers

Add by

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

screenshot of the relevant config interface

like image 93
Balu Avatar answered Oct 13 '22 04:10

Balu