Setting up VS Code for C/CPP Programming for Windows:

VS code is very powerful and very interactive code editor for beginners. Even most of the professional programmer also use the editor because of its versatile nature and the most popular reason is the vast extension library marketplace, owned by Microsoft.

Installing VS Code:

Download the proper configuration of VS Code for your system from their official website or follow the above link.

Leaving all setting to default just click next > next > next and it’s all done. As simple as that unless & until if you don’t do any circus to that.

After Opening it, you will see a welcome screen like this:

Then we are going to install the C/C++ IntelliSense extension which gives suggestion while writing the code.

C/CPP Extension

Click on the extension icon which is on the left side (marked with green color) in search tab > search for the C/C++ (marked by yellow color) install it.

Another cool extension available in VS code to run program in one click is Code Runner > search it and install it.

Code Runner Extension

After installing Code runner we need to do some circus in it.

Click on the gear icon bottom right on the code runner then go to the extension settings > (scroll down for) run code in Terminal >> Click on the check box.

Now we have a icon at the top right corner on the editor (Play button type) for code runner which we use to compile and run code with a single click.

Code Runner Extension Settings

Now, our VS code is ready for writing our code. Wait a while, hold down we still haven’t install the compiler which will convert our source code into executable > machine code.

Installing the Compiler:

There are lots of compiler for C/CPP but we are going to the most popular MingGW compiler.

C/CPP Compiler(s)

Follow the link below to download the MinGW-w64 compiler, or just google and download via sourceforge.net

Run the executable MinGW setup. It will download 200MB file approximately, Now after installing the compiler we have to add our compiler to our environment variable path. So that, whenever any editor call for compiler, it will be redirected to the path.

Goto > Windows C drive > Program files (x86) > mingw-w64 > i686–8.1.0-posix-dwarf-rt_v6-rev0 > mingw32 > bin >>>> copy the path.

Now Right click on > My PC > Properties > Advanced System Settings

A new pop up.

Click on the > Environment Variables…

Then again a pop-up comes > Click on > Edit (for user variables)

The Last pop-up for the setup > Click on >New > Paste the path that we copied from the mingw-w64 folder.

This is optional >> Using Move Up (button move the path to the top.)

After Clicking OK in all the windows that are currently open, We are Done!

Now, We have done a lot of work >> Our computer needs a Restart to complete the process.

Congrats! We have setup VS code for C/CPP programs.

Student | Linux-User

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store