📌 C/C++ Environment Setup for VS Code (తెలుగు మార్గదర్శి)

ఈ గైడ్ ద్వారా మీ కంప్యూటర్‌లో C/C++ కంపైలర్ (MinGW) మరియు VS Code ని సరిగ్గా సెటప్ చేసుకోవచ్చు.

1 మొదటి దశ (Step 1): MSYS2 డౌన్‌లోడ్ చేయడం
  • ముందుగా msys2.org వెబ్‌సైట్‌కి వెళ్ళండి.
  • అక్కడ ఉన్న ఇన్స్టాలర్ లింక్ msys2-x86_64-20260611.exe ని డౌన్‌లోడ్ చేసుకోండి.
2 రెండవ దశ (Step 2): MSYS2 ఇన్స్టాల్ చేయడం & టూల్‌చైన్ అమర్చడం
  • డౌన్‌లోడ్ అయిన ఫైల్‌పై రైట్-క్లిక్ చేసి Run as Administrator ని ఎంచుకోండి.
  • గమనిక: ఇన్స్టాలేషన్ ప్రాసెస్ మొత్తం ఎలాంటి సెట్టింగ్స్ మార్చకుండా డిఫాల్ట్ ఆప్షన్స్‌తోనే సరిపెట్టండి (Next నొక్కుతూ వెళ్ళండి).
  • ఇన్స్టాలేషన్ పూర్తయ్యాక, ఆటోమేటిక్‌గా MSYS2 టెర్మినల్ ఓపెన్ అవుతుంది.
  • ఆ టెర్మినల్‌లో క్రింది కమాండ్‌ను పేస్ట్ చేసి Enter నొక్కండి:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
  • స్క్రీన్ పై ఆప్షన్లు అడిగినప్పుడు 3 టైప్ చేసి Enter నొక్కండి (GCC కోసం).
  • ఆ తర్వాత ఇన్స్టాలేషన్ కొనసాగించడానికి y అని టైప్ చేసి Enter నొక్కండి.
3 మూడవ దశ (Step 3): ఎన్విరాన్మెంట్ వేరియబుల్స్ (PATH) సెట్ చేయడం
  • కంప్యూటర్ ఎక్కడి నుంచైనా కంపైలర్‌ను గుర్తుపట్టడానికి Environment Variables ని ఓపెన్ చేయండి.
  • System Variables విభాగంలో Path ని ఎంచుకుని, Edit పై క్లిక్ చేయండి.
  • New నొక్కి, క్రింది పాత్‌ను యాడ్ చేసి OK నొక్కండి:
C:\msys64\ucrt64\bin
4 నాలుగవ దశ (Step 4): VS Code ఇన్స్టాలేషన్ & ఎక్స్‌టెన్షన్స్
  • code.visualstudio.com వెబ్‌సైట్ నుండి VS Code డౌన్‌లోడ్ చేసుకోండి.
  • డౌన్‌లోడ్ అయిన ఫైల్‌ను Run as Administrator గా ఇన్స్టాల్ చేయండి.
  • VS Code ఓపెన్ చేసి, ఎడమ వైపు ఉన్న Extensions ఐకాన్ పై క్లిక్ చేయండి (లేదా Ctrl + Shift + X నొక్కండి).
  • క్రింది రెండు ఎక్స్‌టెన్షన్స్‌ను సెర్చ్ చేసి ఇన్స్టాల్ చేసుకోండి:
    • C/C++ (by Microsoft)
    • Code Runner (by Jun Han)
5 ఐదవ దశ (Step 5): Code Runner టెర్మినల్ సెట్టింగ్
  • ఇన్‌పుట్ డిఫాల్ట్‌గా పనిచేయడానికి (Read-Only సమస్య రాకుండా) ఈ చిన్న సెట్టింగ్ మార్చాలి:
  • VS Code లో సెట్టింగ్స్ ఓపెన్ చేయండి (Ctrl + ,).
  • పైన సెర్చ్ బార్‌లో Run In Terminal అని టైప్ చేయండి.
  • Code-runner: Run In Terminal ఆప్షన్ పక్కన ఉన్న బాక్స్‌ను Check (✓) చేయండి.
🎉
సెటప్ పూర్తయింది!
ఇప్పుడు మీరు VS Code లో ఎలాంటి C లేదా C++ ప్రోగ్రామ్‌నైనా ఎలాంటి సమస్యలు లేకుండా సులువుగా రన్ చేసుకోవచ్చు.

📌 C/C++ Environment Setup for VS Code (English Guide)

This comprehensive guide will help you install the C/C++ compiler (MinGW via MSYS2) and configure Visual Studio Code for C and C++ development.

1 Step 1: Download MSYS2
  • Visit the official website: msys2.org.
  • Download the installer file: msys2-x86_64-20260611.exe (or the latest version available on the page).
2 Step 2: Install MSYS2 & C/C++ Toolchain
  • Right-click the downloaded executable file and select Run as Administrator.
  • Note: Keep all options at their default settings—simply click Next through the setup wizard.
  • Once the installation completes, the MSYS2 Terminal will automatically open.
  • Paste the following command into the MSYS2 terminal and press Enter:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
  • When prompted to select options, type 3 (for GCC) and press Enter.
  • When asked to proceed with installation, type y and press Enter. Wait for the process to complete.
3 Step 3: Add Compiler Path to Environment Variables
  • Open the Start Menu, search for "Environment Variables", and open Edit the system environment variables.
  • Click the Environment Variables... button at the bottom right.
  • Under System variables, select Path and click Edit....
  • Click New and paste the following path:
C:\msys64\ucrt64\bin
  • Click OK on all open windows to save the changes.
4 Step 4: Install VS Code & Required Extensions
  • Download VS Code from code.visualstudio.com.
  • Right-click the setup file and select Run as Administrator to install it.
  • Open VS Code, click the Extensions icon on the left sidebar (or press Ctrl + Shift + X).
  • Search for and install the following two extensions:
    • C/C++ (by Microsoft)
    • Code Runner (by Jun Han)
5 Step 5: Configure Code Runner to Run in Terminal
  • To avoid the "Cannot edit in read-only editor" error when taking input via cin or scanf:
  • Open Settings in VS Code (Ctrl + ,).
  • Search for Run In Terminal in the search bar.
  • Locate Code-runner: Run In Terminal and check (✓) the box.
🎉
Setup Complete!
Your C/C++ environment is fully configured. You can now write and run any C or C++ program in VS Code seamlessly.