Install c/c extension
Install compilation environment mingw-w64
Download address: http://www.mingw-w64.org/doku.php/download
Configure environment variables, taking WIN10 as an example, this computer-Properties-Advanced system settings-Environment variables-System variables- path-Add a line E:\mingw-w64\mingw32\bin\ (the address of the compilation environment you installed)
After cmd configuration:
Configuring vscode
1) After opening the folder, create a new hello.c for testing:
2) Press F5 to proceed Debugging, the following logo appears, and select
##3) Select launch.json and a launch.json startup configuration file will be generated in the working directory: and modify accordingly The fileThe picture below is after modification: 4) Go back to hello.c and press F5 to debug, you need to select the configuration task
##5) Configure c_cpp_properties.json
5. Others
Once and for all: Because VS needs to be configured separately for each folder, it is recommended to put the .vscode folder at the top level of your commonly used folders, so that you don’t need to repeat the configuration. There is no need for a set of configurations for each new cpp file. These configurations can be used in all subfolders and files within the folder you configured.
Note: There are Chinese characters in the printf statement, and garbled characters are displayed during debugging. You can perform the following operations.
Recommended related articles and tutorials:
vscode tutorialThe above is the detailed content of How to build a C language development environment with vscode. For more information, please follow other related articles on the PHP Chinese website!