So in this article, I’ll show you how you can compile your C/C++ code in Windows. To compile C/C++ code we need GCC/G++ to compile the code but Windows doesn't have a terminal like the Linux terminal or Mac terminal.
So instead, to compile your code in Windows VS Code, we need an extension called the C/C++ Compile Run extension.
To install it, you need to open your VS Code and goto extensions (shown in the below image ) and search for C/C++ Compile Run by danielpinto8zz6, install it.
Your 1 step is completed, now you need to install MinGW.
It is a free and open-source software development environment to create Microsoft Windows applications.
Go to its official site in the navigation section download.
Click on download and it will redirect you to the download page and click on
The windows icon like shown in the below image after the download installs it.
After successfully installation open MinGW Installation Manager.
It will look like the image. Click on "basic setup" and click on "all packages". Then, go to installation and click on "apply changes", it will take some after successfully applied.
You need to do one more thing to setup the environment.
Open your System Properties and click on Environment Variables.
Now select on System variables Path and click on edit.
Now click on new and go to Browse and in C drive find the MinGW folder and select bin folder.
That’s it - your environment has been setup.
Now you can compile your C/C++ code in your VS Code by pressing f6 on your keyboard.
That’s all about the code compilation in Windows. If you have any kind of doubt you can ask me or you can see my video.
I hope this helps you if you have any query feel free to ask.
Previously published at https://laptrinhx.com/how-to-compile-c-c-code-in-vs-code-windows-2735242511/