The following solutions are generally used to solve this problem:
(1) Scanf and other similar functions are not safe. To ensure the security of the program, it is recommended to use them in the future_ S, but many previous programs may still use unsafe versions. Here are some ways to get rid of this error prompt.
(2) When creating a new project in VS, remove the “safe development life cycle (SDL) check” to turn the error into a warning, so that the use of unsafe versions will not affect the compilation and operation
(3) In the front of the header file, remember to add: #define at the front (in front of include)_ CRT_ SECURE_ NO_ WARNINGS This macro definition
(4) Add: #pragma warning (disable: 4996) at the beginning of the compiled header file
(5) Project properties – & gt; Configuration Properties-> C/C++-> Preprocessor-> Enter preprocessor definitions, click the button (…) and enter:_ CRT_ SECURE_ NO_ Warnings, use “\ n” to separate them.
In short, if you want to do no security check at all, use the method in (2) or the method in (5). If you just don’t use some files, you can use the methods in (3) and (4). If you like to use the method in (2), you can choose according to your needs. However, with the gradual improvement of the importance of security, I suggest you use the safe version in the future
Copyright notice: This is the original article of CSDN blogger “Junlin, Tianxia”, which follows the CC 4.0 by-sa copyright agreement. For reprint, please attach the original source link and this notice
original link: https://blog.csdn.net/dan15188387481/article/details/49622783/
- [Solved] VS error C4996: ‘scanf’: This function or variable may be unsafe.
- Python PIP installs scrapy with an error of twisted
- bash :startx command not found
- cleartext http traffic to 192.168.1.106 not permitted
- Completely solve MySQL error: 1030, ‘got error 28 from storage engine’
- java.io.IOException: Server returned HTTP response code: 405 for URL:
- How to solve Visual Studio error C4996
- Dynamic Web Module 3.1 requires Java 1.7 or newer
- AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- [Solved] remote: HTTP Basic: Access denied Authentication failed for ‘https://’