How to Compile your C/C++ code on the Visual Studio Code.
Hello Everyone
As you know we have already learned the basics of c++ in our previous posts. The first tutorial on my account was C++ its because when you are completely new to programming it is recommended to learn a high-level language like c/c. When you know these languages it is easy for you to switch languages. In previous tutorials, we used Dev C because we were not able to run our script on the VS code. SO in this post, I am going to fix the problem. We are going to configure the Visual Studio Code for C++. To compile our code on VS code we need to install few things and configure our setting a little bit so without wasting time let's get started.
First of all, let me show you what errors we are getting while compiling our c++ code on the Visual Studio Code.
I have a simple Hello World code on the VS code. But when I run it
It is tell me that 'g++' is not recognized as an internal or external command, operable program or batch file. Plus it has some problems as well.
We are going to fix them in this post. So follow my steps and in the end, we will able to compile our code on the Visual studio code
- We need to install a software called minGW. Visit this site to download this.
- To check whether you have the software installed or not open Command Prompt and type
gcc --version
In my case, I don't have installed.
- After downloading the file open it
click on the install then continue and it will start downloading the necessary files. Make sure you have working internet connection.
Once done downloading click on continue. On the next step select this option
- In the menu at the top left corner, click on “Installation > Apply Changes”
- Wait for movements. When it is done it you should see something like this
- Click on the "Close the Dialog when activity is completed and wait for the window to be closed.
Now we need to include the directory where the C++ compiler is located the environment variable.
- Go to Control panel Items and open "Advance System Settings".
- Now click on "Envoirment Variabels".
Select the Path and click edit.
Click "New" paste this
C:\MinGW\binand save it.Let's check the version again
- As you can see the minGW is installed. Now let's run the program again.
- Install the code runner Extenstion as well if you don't have it.
I think this much is enough for today. Now if you like the post please upvote and comment if you want to give me some advise
Leave How to Compile your C/C++ code on the Visual Studio Code. to:
Read more #hive-148441 posts
Best Posts From ProGrammer
We have not curated any of pakgamer's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From ProGrammer
- What do you think your Password is Secure?
- Nodejs Tutorial-- Sending Email using NodeMailer
- Node.js Tutorial --Reading and Writing files
- How to install Nodemon-- Express.js Tutorials
- How to use Range Element in a simple voting tool
- Learning Express.js-- installation and Hello World Example
- How to Compile your C/C++ code on the Visual Studio Code.
- How to check Voting Power And Resource Credit of Hive Account Through dhive
- How To Send Message TO WhatsApp Using JavaScript/Node.js-- Twilio
- How to add Custom prefix to your Discord Bot. Discordjs Tutorial
- HiveJs Tutorials --Learning how to transfer HIVE/HBD thorugh HiveJs
- Fetching API -- JavaScript Tutorial
- Learning Local Storage in JavaScript..
- Hivejs Tutorials-- #3
- Learn jQuery. Learning Events/Methods
- Learn jQuery --- Learning Selectors
- Learning JQuery-- Understanding the basics
- TypeScript for beginners -- A quick start
- How to Stream Hive Blockchain Transactions.-- HIVED
- Grand Theft Auto V (GTA 5) is now free on Epic Games Store.