Run C, C++ on Visual Studio Code
Table of contents
1. Install the plugin in Visual Studio Code
2. Install the C/C++ compiler MinGW-w64
2.3 MinGW-w64 installation error, what to do (no problem with installation can be ignored)
2.4 Configure environment variables
3. Write C language code and run it
Visual Studio Code download address: https://code.visualstudio.com/
1. Install the plugin in Visual Studio Code
1. C/C++ (must be installed)
2、Code Runner
C/C++
Code Runner
2. Install the C/C++ compiler MinGW-w64
MinGW-w64 download address: MinGW-w64 - for 32 and 64 bit Windows download | SourceForge.net
2.1 Download MinGW-w64
1. Click on files
2. Pull down, find MinGW-W64 Online Installer and click to wait for the download
2.2 Install MinGW-w64
i686 corresponds to a 32-bit operating system, and x86_64 corresponds to a 64-bit operating system
Choose win32 for windows, and posix for others.
seh (64-bit support), dwarf (32-bit support), sjlj (32-bit and 64-bit support)
sjlj has good stability, dwarf and seh have better performance
waiting for installation
2.3 MinGW-w64 installation error, what to do (no problem with installation can be ignored)
If
the download reports an error and cannot be resolved, just download the offline installation package directly.Here I provide several offline installation packages (search and download the corresponding offline packages according to your own needs)
MinGW-w64 for Windows(x86_64-8.1.0-release-win32-seh-rt_v6-rev0.7z) offline package
Download link: https://www.jb51.net/softs/696088.html
MinGW-w64 for Windows(x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z) offline packageDownload link: https://www.jb51.net/softs/696087.html
After downloading the offline installation package, just unzip it directly
2.4 Configure environment variables
1. First find the bin directory under the installation path of MinGW-w64. Ctrl+C copy path
My installation path D:\work\mingw64\bin
2. Configure environment variables
Right-click "This Computer" --> Properties --> Advanced System Settings --> Environment Variables --> Path Edit in System Variables
——>New—>Paste—>Click “OK” all the way (configuration complete)
Click Environment Variables, find the system variable Path, and click Edit.
Click New, paste the previously copied path, and click OK
Next, test whether the configuration is successful:
win+r key, enter cmd, press enter
Enter gcc in the cmd window and press Enter
Appear :
gcc: fatal error: no input files
compilation terminated.
In this way, the configuration is successful
3. Write C language code and run it
Re-open the Visual Studio Code software
Create a folder anywhere on your computer, and open it with Visual Studio Code
Create a new file, main.c
Write code
#include <stdio.h>
int main(){
printf("Hello,World!");
return 0;
}
click to run
Visual Studio Code can run C and C++!
If there are mistakes, please correct me.
Finally I have a personal question:
I got the C language version of the Contra code before I started working on the C language environment.
I don't know how to run this game on Visual Studio Code (or can not). I hold the code like a fire stick, the IQ bar is not enough. Can you give me a detailed running tutorial? Please @me if you can, thank you very much.
Contra code in C language:
CSDN download (free):
C language version Contra (free)-C documentation resources-CSDN download
Network disk download:
Link: https://pan.baidu.com/s/1MisisXArd_HB99MzkyqpSw
Extraction code: y0u3
Get more programming software resources:
Equipment for java beginners (software, learning routes, resources)