This function or variable may be unsafe.

Article Directory


Record it, the issue is simple.
When the compiler encounters vs

error C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

The reason is that this function is too old, it is now being replaced by the new security function.
In general we can modify the new function.
Strcpy_s above may be used instead.

If you do not want to modify the code if
there is a solution in two ways:
1, macros defined in the precompiled there: _CRT_SECURE_NO_WARNINGS
2,
added in front of cpp file

#  pragma warning(disable : 4996) /* disable deprecation warnings */
Published 147 original articles · won praise 18 · views 120 000 +

Guess you like

Origin blog.csdn.net/lanxiaziyi/article/details/104476562