Get C/C extension
Open vscode
ctrl shift x open store
Search for C /C
Install and restart vscode
Install GCC
Download MinGW
Open the installer and install to D disk (you need to create the MinGW folder). After the installation is completed, the MinGW installation manager will be generated.
The manager will open 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
Configure smart prompts
Write a test file demo.c, click on the "prompt light" under the imported standard library, Generate c_cpp_properties.json fileEdit c_cpp_properties.json##c_cpp_properties.json modification content is as follows:
Enable debuggingF5 or Ctrl F5 enables 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 occurs: 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 language in vscode. For more information, please follow other related articles on the PHP Chinese website!