Today I will show you How to Set up Visual Studio Code for C and C++ Programming.
Before Setting up Visual Studio Code for C and C++ Programming you first need to install Mingw 64 on your pc.
Now I am going to show you how to install and set up visual studio code in your windows 10 operating system and then I will also show you how to set up your visual studio code for c and c++ programming languages
How to install visual studio code
To use GCC compiler for c and c++ first you need to install vs code for your pc. Here are the steps to install visual studio code.
- So let’s begin now to install visual studio on your windows 10 operating system first you need to download it by clicking here
- Now after downloading Visual Studio Code, Just double-click on it to install
- After accepting the license agreement, click on Next and choose your installation directory. I again recommended keeping it default.
- Click on next.
- Now in this step, Check all the options as shown in the below screenshot (important). Now click on next and tap on install.
After installation has finished click on the finish.
Now open the vs code because you need to add extensions in VS code which will help you to run the c or c++ code more efficiently.
- These two extensions are
- Code Runner
To download these extensions just open Visual Studio Code and click on the icon shown below
- And search c/++ and install the extension by simply clicking on the install button
- The next extension we are going to install is code runner.
To download this extension search code runner as you search before and click on that install option and wait for the installation to finish
After installing both extensions restart your Visual studio code.
Here is one important thing
After installing the code runner extension, The problem in your program is that if you have to take input from the user then from this output tab we can’t really provide the input that’s because this output tab is read-only. So we need to have a solution for this one.
To solve this error
- First click on the file showing at least the top corner.
2. And you have to go to preferences and Here select settings
3. And here you need to click on extensions Now if you scroll down then you guys can see the run code configuration click on that,
And again scroll down and here you need to check the run in the terminal.
- and after that press Ctrl+S to save it and
- close the settings
Writing and running the first program
Now as we Set up Visual Studio Code for C and C++ Programming, So now to check that your Gcc and visual code are working we need to check it by running a simple C program.
For that open any folder on your pc. Now, right-click and open visual studio code.
To run your first program create a file like a demo.cc as shown.
And Write a simple c program as
NOW save it by pressing Ctrl+s and clicking on the run button,
If your program runs successfully, congrats successfully Setting up Visual Studio Code for C and C++ Programming languages.
But if it’s showing some error message us on Instagram or comment down we will try our best to solve your problem. If this article about How to Set up Visual Studio Code for C and C++ Programming is helpful to you, share it with your friends.
Check our other articles
Hello everyone, I am currently an engineering student who loves to write about the latest technology, gadgets, and reviews.