Can vscode run c language?
First, install VScode. Just go to the official website to download the installation package and install it. I won’t go into details here. Then, install the plug-in extension:
Related recommendations: vscode introductory tutorial
Then install mingw-w64, correspond to the corresponding version installed on your computer, but now it is generally 64-bit.
The download link is here, but when I installed the MinGW-W64-install.exe file, I had a problem that it could not be downloaded, so it is recommended to directly download the compressed package and decompress it (as shown in the picture):
After installation, unzip it to the location you want. The next step is to configure the environment variables:
Right-click on My Computer->Properties->Advanced System Settings -> Environment Variables -> Find Path in the system variables and click Edit:
to the directory you decompressed, then open the command line cmd window and enter gcc -v tests whether the configuration is successful.
Open VScode, create a new folder under the project file you want to write in C language, named .vscode, then create a new C language file in your project directory, and write some test code ( Mine is test.c):
Click the bug-like button, then click the small gear icon of the settings, select C (GDB), and then you will be asked to choose One, select the first one at this time. After clicking, VScode will automatically generate two files for you, launch.json and tasks.json. At this time, the environment is configured, and CTRL F5 can compile and run the C program.
The above is the detailed content of Can vscode run c language?. For more information, please follow other related articles on the PHP Chinese website!