1. Install c/c extension
2. Install the compilation environment mingw-w64
Configuration environment Variables, taking WIN10 as an example, this computer-properties-advanced system settings-environment variables-system variables-path-add an E:\mingw-w64\mingw32\bin\ (the address of the compilation environment you installed)
3. Configure vscode
1. After opening the folder, create a new hello.c for testing:
2. Press F5 to debug, the following logo will appear, and select
3. Select launch.json and a launch.json startup configuration will be generated in the working directory. File: and modify the corresponding file
4. Return to hello.c and press F5 to debug. You need to select the configuration task
5. Configure c_cpp_properties.json
Four. Others
Once and for all: because VS needs to provide Folders need to be configured separately, so it is recommended to put the .vscode folder at the top level of your commonly used folders so that you don’t have to configure it repeatedly. 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 tutorial: vscode tutorial
The above is the detailed content of How to install c language environment in vscode. For more information, please follow other related articles on the PHP Chinese website!