Installing and Setting Up C++

To write and run C++ programs, we need two main things:

  • A C++ Compiler: It converts C++ code into machine code (e.g., GCC, MSVC).
  • An Editor or IDE: A place to write your code (e.g., VS Code, Code::Blocks, Dev-C++, etc.).

1. Setup C++ in VS Code (Windows):

  • Download and install VS Code from https://code.visualstudio.com/.
  • Install the MinGW (G++) compiler:
    1. Download from: MinGW-w64.
    2. During setup, select architecture as x86_64 and threads as posix.
    3. Add the bin folder path to System Environment Variables > Path.
  • In VS Code, install the C/C++ extension by Microsoft.
  • Open your C++ file and save it with .cpp extension.
  • Use the terminal to compile:
    g++ filename.cpp -o output
  • Then run the program:
    ./output

2. For Linux Users:

  • Open terminal and type the following command:
sudo apt update
sudo apt install g++

Now you can write and run C++ programs directly from the terminal.

3. For macOS Users:

  • Install Xcode Command Line Tools by running:
xcode-select --install

This installs the Clang compiler which supports C++. You can also use IDEs like VS Code or Xcode.

4. Verifying Installation

To verify that the C++ compiler is installed correctly, open terminal or command prompt and type:

g++ --version

If you see version information, it means your compiler is ready to use.

Summary:

  • Install a C++ compiler like GCC (via MinGW or built-in on Linux/macOS).
  • Use a text editor or IDE (like VS Code, Code::Blocks).
  • Set environment paths (on Windows).
  • Use terminal/command prompt to compile and run C++ code.

Welcome to ShikshaSanchar!

ShikshaSanchar is a simple and helpful learning platform made for students who feel stressed by exams, assignments, or confusing topics. Here, you can study with clarity and confidence.

Here, learning is made simple. Notes are written in easy English, filled with clear theory, code examples, outputs, and real-life explanations — designed especially for students like you who want to understand, not just memorize.

Whether you’re from school, college, or someone learning out of curiosity — this site is for you. We’re here to help you in your exams, daily studies, and even to build a strong base for your future.

Each note on this platform is carefully prepared to suit all levels — beginner to advanced. You’ll find topics explained step by step, just like a good teacher would do in class. And the best part? You can study at your pace, anytime, anywhere.

Happy Learning! – Team ShikshaSanchar