Skip to main content

Featured Post

Microtask And Macrotask in JavaScript (Finally Explained Simply)

Ultimate Guide: C++ Setup in Visual Studio Code (VS Code)

Ultimate Guide: C++ Setup in Visual Studio Code (VS Code)

Friends if you Want to write and run C++ code in Visual Studio Code, but not sure how to setup vs code for c++? in this blog article i tell you how to install c++ in vscode


Step-by-Step process for How to Set Up C++ in VS Code

Ultimate Guide: C++ Setup in Visual Studio Code (VS Code)



Step 1: First we have to Download & Install Visual Studio Code

 For Install VS code You have to Go to: (https://code.visualstudio.com)

 Download for your OS according to your device (Windows, Mac, Linux)

 Install like a normal app

 

Step 2:Now we have to Install a C++ Compiler

 C++ needs a compiler to run our code.

For Windows Use MinGW-w64 

you can Download from:

https://www.mingw-w64.org/(https://www.mingw-w64.org/


Steps:

1. Run the installer and choose the architecture for 32 bit or 64 bit according to your device

2. Install it in a folder 

3. now you have to go in this folder then bin and copy the path 


Step 3: We have to Add Compiler to System PATH (Windows)

 How to Add MinGW to PATH f (Windows):

1. First Open the Start menu, search for → Environment Variables

2. Click on Edit the system environment variables"

3. In the window, click the button → "Environment Variables"

4. Under System variables, find → `Path` → Click Edit

5. Click New and paste in the path to your `bin` folder.

For example:

C:\Program Files\mingw-w64\...\bin

   

6. Click OK, OK, OK.


And Our Setup of VS code is almost done

 Now open a new terminal and type:

 g++ --version

You should see the version info, it means it works!

vs code setup for c++ in macOs:

Just open Terminal and run this command for Confirms it installation XCode-select --install

This installs Apple’s official C++ tools, including `clang`


  •  Setup For Linux (Ubuntu) for Vs code 

For Ubuntu user You have to go In Terminal type this command

sudo apt update && sudo apt upgrade -y

sudo apt install -y build-essential gdb


This Will install tools like g++, gcc, make, and other tools.

 

Step 4:Now We have to Install C++ Extension in VS Code

1.First Open VS Code

2. Go to the left sidebar → Click Extensions (or press shortcut for `Ctrl+Shift+X)

3. Search: C/C++

4. Install the one by Microsoft

This gives us features like IntelliSense, debugging, and more.


Step 5:now how we can create our first c++ program


1. First We have to Make a new folder (e.g., my-cpp-project)

2. in that folder create a file: first.cpp


Write this code

cpp

#include <iostream>

using namespace std;


int main() {

    cout << "Hello, C++ in VS Code!" << endl;

    return 0;

}


Step 6: Set Up Build Task to Compile Your Code


Let’s make it easy to compile your code with one shortcut.


1. In VS Code, go to the top menu:

   TerminalConfigure Default Build Task

2.You have to go and choose: C/C++: g++ build active file


It will help us for auto-create a `.vscode` folder with a `tasks.json` file.


Now press `Ctrl + Shift + B` → This help us for builds (compiles) our code!


Step 7: For Run our Program

After compiling, a new file will be created:

 1.On Windows → `main.exe`

 2.On Linux/macOS → `a.out`


for run it:

Open Terminal in VS Code, then type:

./main.exe ← for

 Windows  

./a.outfor Linux/macOS

You’ll see output:

Hello, C++ in VS Code

Frequently asked questions:

1.how to check mingw installed or not in cmd.

Ans:To Check Mingw installed or not in cmd open a new terminal and type:g++ --version

If You see the version info, it means it works!

2.how to setup vs code for c++ in ubuntu

Ans:For Ubuntu user You have to go In Terminal type this command

sudo apt update && sudo apt upgrade -y

sudo apt install -y build-essential gdb

This Will install tools like `g++`, `gcc`, `make`, and other tools.

Conclusion: Here in this blog Article I have share how to setup or install Visual studio for Windows Macbook and Ubuntu for C++ and How to write Your first C++ program in Visual studio And also Some Shortcut also to Run Code on Visual Studio I hope You Like Our Article.



Comments

Popular posts from this blog

12 Beginner Mistakes and Errors in JavaScript You Should Know

 12 Beginner Mistakes and Errors in JavaScript You Should Know Friends, we all know JavaScript is a very popular programming language for developing the website and the web app. However, learning JavaScript as a beginner can be difficult, friends. We will have find some of the most common problems beginners face in JavaScript and how to solve them. 1. Understanding Variables and Data Types Friends, one of the first things when you learn the JavaScript variables . Variables are used to store information. The beginner coder many times confused in different data types such as number, string and Boolean. For example, if you try to add a number and a string, you may get an unexpected result: I will take this following example let result = 1 + "1"; Output of this program is 11 not 2 Tip: Friends, always make sure you know the type of data you are working with. You can use the typeof keyword to check. 2. Forgetting to Declare Variables Friends, in JavaScript we use let, const a...

How to Use Codeium for Faster Coding in VS Code (Beginner Guide 2025)

    How to Use Codeium for Faster Coding in VS Code (Beginner Guide 2025) Codeium is an AI code  assistant that helps developers by providing smart code suggestions and autocompletion as you type. It’s like having a coding partner   inside your IDE.   In this blog article I also tell  how to install codeium in vs code  features of codeium  1. codeium help us in autocompletion  it suggests us code while typing completion as you type  2.you  can type comments the code needed  it will  Automatically generated by the codeium. 3.codeium  can support in 70+ programming  languages like  c,c++,java and python  go and many more  4.you can  integrate in your code editor available  as a plugin for vs code and jetbrains jupyter lab and more  5  codeium is free for individual coders  and developers   How to Install Codeium in VS Code 1.Open  VS Code 2.Go to  Ext...

10 Dev Tools Every Coder Should Try Before 2026

  10 Dev Tools Every Coder Should Try Before 2026 Friends now days technology changing very fast and we have to update ourself as per the technology there are 10 tools that are very helpful for you to writing code efficiently. 1. GitHub Copilot This ai tool you help alot writing codes faster it gives you suggestion while coding also helps in. Understand the error and mistakes in code it gives complete function also in suggestion it gives repetitive code. 2. Cursor ai For generation of code to debugging it helps alot saving time it will help a lot in testing and generating codes alot. 3. Docker Friends Docker helps us to create isolated environments for our applications . This means our code runs the same way on every machine. It makes testing and deployment more reliable . Many companies are using Docker in production, so learning it gives you an edge. 4. GitHub Actions Friends This tool helps us alot in automation of tasks like testing, building and deploying our code. It works...