paint-brush
How to Compile C/C++ Code in VS Code (Windows)by@nobody1234
11,146 reads
11,146 reads

How to Compile C/C++ Code in VS Code (Windows)

by nobodyMarch 16th, 2021
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

How to Compile C/C++ Code in VS Code (Windows): To compile C/C++ code we need GCC/G++ to compile the code but Windows doesn't have a terminal.

Company Mentioned

Mention Thumbnail
featured image - How to Compile C/C++ Code in VS Code (Windows)
nobody HackerNoon profile picture

Compile your C/C++ code in Windows using Visual Studio code

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/

https://www.subpals.com/?ref=8046