How to Download and Install MinGW C/C++ Compiler: A Step-by-Step Guide

MinGW (Minimalist GNU for Windows) is a popular compiler suite that allows you to compile C and C++ programs on Windows systems. Here’s a complete walkthrough to get you started:

‌Step 1: Download MinGW‌

  1. Visit the Official Website
  2. Run the Installer
    • Open the downloaded .exe file.
    • Follow the setup wizard (default settings are fine).

‌Step 2: Install Required Packages‌

  1. Launch the MinGW Installation Manager
    • After installation, open ‌MinGW Installer‌.
  2. Select Essential Packages
    • Under ‌Basic Setup‌, check:
      • mingw32-base (C compiler)
      • mingw32-gcc-g++ (C++ compiler)
      • mingw32-gcc-objc (Objective-C, optional)
    • Right-click each and choose ‌Mark for Installation‌.
  3. Apply Changes
    • Go to ‌Installation → Apply Changes‌ and confirm.

‌Step 3: Add MinGW to System PATH‌

  1. Locate the Installation Directory
    • Typically at C:\MinGW\bin.
  2. Update PATH Environment Variable
    • Press Win + R, type sysdm.cpl, and go to ‌Advanced → Environment Variables‌.
    • Under ‌System Variables‌, find PATH, click ‌Edit‌, and add: C:\MinGW\bin
    • Click ‌OK‌ to save.

‌Step 4: Verify Installation‌

  1. Open Command Prompt‌ (Win + R → cmd)
  2. Check GCC Version
gcc --version

If installed correctly, you’ll see version details.

Hello World!

#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}

Leave a Comment