for declared C4996: ‘sprintf’ was declared deprecated or warning C4996: ‘strcpy’ was declared deprecated if used in vs2003, vs2005 or vs2019. Here are some ways to solve the problem. Method 1: call those non-standard functions with the suffix “_s” advocated by VS2005, followed by “_s”, as sprintf is changed to sprintf_s.
method 2: add #define _CRT_SECURE_NO_DEPRECATE or #pragma warning(disable:4996) at the beginning of the file, which isa method of ignoring warnings (which is rarely used).
method 3: dry substance set in the project properties (recommended).
is set in the Project property as follows:
opens project-settings –Resources– Preprocessor definitions for VC6:
, and adds _CRT_SECURE_NO_DEPRECATE and _SCL_SECURE_NO_DEPRECATE macros to
version for VS series:
open project, the project properties – configuration properties – C/C + + preprocessor definition pretreatment,
add _CRT_SECURE_NO_DEPRECATE and _SCL_SECURE_NO_DEPRECATE both macro.
- Error c2137 of C language: empty character constant (Fixed)
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- Differences between length() size() and C strlen() of C + + string member functions
- Solve the problem of error: cannot pass objects of non trivially copyable type ‘STD:: String’ in C / C + +
- Error C2664 in C + + compilation: cannot convert parameter 2 from “const char ” to “lpctstr” solution.
- Error c2065: ‘new’: undeclared identifier, mainly because it is a. C file
- Solution to the problem of no C / C + + option in the new project of eclipse
- [Solved] Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
- ninja Compiling the C compiler identification source file CMakeCCompilerId.c failed
- C++：error C2228: left of ‘.str’ must have class/struct/union
- To solve the running error of eclipse for C / C + +: launch failed binary not found
- Error: unrecognized command line option “-std=c++11”, to solve the problem that ubuntu does not support c++11
- Solution to the flash of running result of dev C / C + +
- Fatal error C1853 error occurs when there are mixed .c files in the VS project
- Chinese garbled code when vscode calls CMD to run C / C + +
- R language – error analysis – error in Call.graphics (C_ palette2, .Call(C_ palette2, NULL)) : invalid graphics state
- Debugging failed under vscode Ubuntu, unable to open libc-start. C raise. C, etc
- C / C + + error handling (document): unhandled exception: 0xc0000005: access violation while reading location 0x00000000
- MPI cannot be found in C / C + +
- C / C + + rounding function ceil(), floor ()