preface
VSCode is just an editor. If you want to run C programs, you need to download something called a compiler.
C language development has many years of history, a lot of compilers, each compiler of C language standard support degree is not the same, commonly used compiler GCC, LLVM+Clang, MSVC.
This article teaches you how to use GCC + VSCode with C/C++ development environment.
GCC download
Resources to prepare
Because GCC is developed abroad, here directly give me GCC compression package. Just unzip it after you download itYou are advised to decompress the package to a folder to facilitate the configuration of environment variables.
Start the configuration
Next, put the unzipped folder in the desired directory and open the bin directoryFor this directory, copy the address of the file and click on the address barGo back to the desktop and right click on this computer -> Properties -> Advanced System Settings -> Environment VariablesThen create a new one, and just paste what you just copied here
Next win+r type CMD to bring up the command line, typegcc
The correct display should look something like thisIf yours is not the same as the blogger’s, please repeat the above steps, if not, you can leave a message to me, I will see the reply.
Now you can use notepad to write C/C++ programs. Next, open VSCode and download the plug-ins needed to write C/C++
Click on this thing and type c++ in the text boxthen After the third plugin is downloaded, you can run C code using F6. Next, you need to configure VSCode Settings. Go to VSCode file -> preferences -> SettingsFind the Compile Run configuration and check run-in-external-terminalWhen you use F6 to run C/C++ program, it will automatically pop up a black window like DevC++ and VS. When you open a folder and run C/C++ program, you will find an exe program with the same name as the C file. At this point we can filter.exe files in the Settings.Then in this box, write.exe
This is the end of the tutorial, I hope you all become a strong C language.