Setting Up the Environment of C++

By Shakib Ansari | Date: Sat, May 31, 2025

C++ Programming Setup

C++ seekhne ke liye, first step hota hai apne system par sahi environment setup karna. Is blog mein hum IDE install karna, apna pehla C++ program likhna aur run karna, aur C++ program ka structure detail mein samjhenge.

Step 1: IDE Install Karna (Visual Studio Code)

IDE ka matlab hota hai Integrated Development Environment – ek aisa tool jahan aap code likh sakte ho, run kar sakte ho aur debug bhi kar sakte ho.

VS Code Install Karne ke Steps:

  1. VS Code download karohttps://code.visualstudio.com
  2. Setup file install karo (Next, Next karke complete install ho jayega).
  3. Ek aur zaroori cheez hai – C++ compiler. Hum use karenge MinGW.

MinGW Compiler Setup:

  1. Download karo MinGW: https://sourceforge.net/projects/mingw/
  2. Installation ke baad bin folder ka path copy karo (example: C:MinGWin).
  3. Ye path ko Environment Variables > System Variables > Path me add karo.
  4. Command Prompt khol ke likho:
g++ --version

Agar version show ho gaya to setup successful hai!

Step 2: Apna Pehla C++ Program Likho aur Run Karo

Code:

#include <iostream>
using namespace std;
int main() {
    cout << "Hello, C++ World!" << endl;
    return 0;
}

Isse run kaise karein?

  1. File ko save karo as hello.cpp.
  2. Terminal open karo (VS Code ke andar ya CMD).
  3. Compile command likho: g++ hello.cpp -o hello.
  4. Phir run karo: ./hello.

Agar output aaya Hello, C++ World!, to done Environment poori tarah setup ho gya aur program bhi run ho gya.

Step 3: C++ Program Ka Structure Samjho

Har C++ program ka ek basic structure hota hai. Lets breakdown:

#include <iostream>  // Header file, input-output ke liye
using namespace std; // Namespace use kar rahe hain

int main() {         // Main function – entry point
    cout << "Hello"; // Output command
    return 0;        // Program successful terminate hota hai
}

Points to Remember:

  • #include <iostream>: Ye library hoti hai input/output ke liye.
  • using namespace std;: Hum std::cout likhne se bachne ke liye use karte hain.
  • int main(): Har C++ program yahin se start hota hai.
  • return 0;: Ye batata hai ki program sahi se run hua.

Conclusion:

  1. VS Code aur MinGW setup karna hai,
  2. Apna pehla C++ program likh ke run karna hai,
  3. Aur C++ ka basic structure samajhna hai.
About the Author

Hi, I'm Shakib Ansari, Founder and CEO of BeyondMan. I'm a highly adaptive developer who quickly learns new programming languages and delivers innovative solutions with passion and precision.

Shakib Ansari
Programming

Comments