1. Obtain C/C extension
1. Open vscode
2. ctrl shift x open store
3. Search C/C to install and restart vscode
2. Install GCC
1. Download MinGW
2. Open the installation program and install Go to the D drive (you need to create the MinGW folder). After the installation is completed, the MinGW installation manager
3 is generated. The manager opens automatically (if not, please do it manually), click All Packages, select gcc.bin, g .bin , gdb.bin, click Installation, select Apply Changes, click Apply to submit for installation
##win R, enter control to enter the control panel, click System and Installation->System ->Advanced System Settings->Environment Variables, find Path->Edit->New, and paste the path to the bin folder of the installed MinGW. 3. Configure intelligent prompts1. Write a test file demo.c, click on the "prompt light" under the imported standard library, and generate c_cpp_properties .json file2. Edit c_cpp_properties.json##c_cpp_properties.json and modify the content as follows:
4. Enable debugging
F5 or Ctrl F5 to enable debugging, select C (GDB/LLDB) to generate the launch.json file, modify it as follows:
Ctrl Shift P Enter Tasks:Configure Task to configure the task, choose to use the module to create the task.json file, select the Others template, generate the task.json file, modify it as follows:
If An error occurred: process terminated, exit code: 1, it may be that gcc has not been loaded by the editor (test method: open the console, enter gcc, and see the prompt message), just restart the editor.
Recommended tutorial:
vscode tutorialThe above is the detailed content of How to write c program with vscode. For more information, please follow other related articles on the PHP Chinese website!