How to install and use VS2022 in C language
This article mainly introduces the relevant knowledge of "how to install and use VS2022 in C language". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope this article "how to install and use VS2022 in C language" can help you solve the problem.
First, install VS2022
Tips: when selecting installation information, check "General Windows platform Development" when learning the C language, and "Desktop Development using C++", considering that you will use it later. It is worth mentioning that after the installation is complete, this installation information can also be modified in the subsequent learning process.
Second, create a project test program
Click the top status bar to debug-start execution (do not debug) and run the program.
Success!
Third, encounter problems
In VS2022, there was an error compiling with the scanf function: error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _ CRT_SECURE_NO_WARNINGS. See online help for details.
IV. Solutions
Add macro definition to cancel safe security, or use scanf_s
Add macros to define ways to remove safe security:
Add at the beginning of the code:
# define _ CRT_SECURE_NO_WARNINGS
As shown in the following figure:
But it seems a little troublesome to add a macro definition every time, and there is a good way:
Find a file called "newc++file.cpp" in your vs2022 installation directory, open it as an administrator, add # define _ CRT_SECURE_NO_WARNINGS, and save it. This code will exist when you create the source file later, so as not to add it again.
This is the end of the content about "how to install and use VS2022 in C language". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.