This repository contains automated scripts to install MinGW-w64 (g++) compiler on Windows systems.
- π Quick Start (One-Liner Installation)
- βοΈ What These Scripts Do
- π Requirements
- π οΈ Script Options
- β After Installation
- π§ Troubleshooting
- π What Gets Installed
- π File Locations
- ποΈ Uninstallation
- π― TL;DR - Just Want g++ Working?
- π License
Copy and paste this command into PowerShell:
irm https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iexThis command will:
- Download the installation script directly from GitHub
- Execute it immediately
- Install g++ for the current user (no admin required)
- No need to clone the repository
Requirements for one-liner:
- Windows PowerShell 5.1+ or PowerShell Core 7+
- Internet connection
- Execution policy that allows remote scripts
If you get execution policy errors:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserFor system-wide installation (requires admin):
irm https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iex -Args "-SystemWide"Alternative one-liner with parameter:
# User-only installation (default)
iwr -useb https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iex# System-wide installation
iwr -useb https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iex -Args "-SystemWide"
π Security Note: The one-liner downloads and executes a script from the internet. While convenient, always verify the source and content before running. You can inspect the script first by visiting the GitHub URL in your browser.
# Download the repository first, then run:
# Run as regular user (installs for current user only)
.\install-gcc.ps1
# Run as Administrator (installs system-wide)
.\install-gcc.ps1 -SystemWide
# Skip installation if already installed, just fix PATH
.\install-gcc.ps1 -SkipInstall# Double-click or run from command prompt
install-gcc.bat- Install MSYS2 via winget (Microsoft package manager)
- Install MinGW-w64 GCC toolchain via MSYS2's pacman package manager
- Add compiler to PATH environment variable
- Verify installation by testing g++ command
- Windows 10 version 1809 or later (for winget)
- Internet connection
- Administrator privileges (recommended, but not required for user-only installation)
| Parameter | Description | Default |
|---|---|---|
-SystemWide |
Install for all users (requires admin) | false |
-UserOnly |
Install for current user only | true |
-SkipInstall |
Skip installation, just fix PATH | false |
-Verbose |
Show detailed output | false |
One-liner installations:
# Quick install (user-only)
irm https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iex
# System-wide install (as admin)
irm https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iex -Args "-SystemWide"Local script executions:
# Install for current user only (no admin required)
.\install-gcc.ps1 -UserOnly
# Install system-wide (requires admin)
.\install-gcc.ps1 -SystemWide
# Just fix PATH if already installed
.\install-gcc.ps1 -SkipInstall
# Verbose output
.\install-gcc.ps1 -Verbose- Restart your terminal/IDE to pick up PATH changes
- Test the installation:
g++ --version
- Run your Python test case generator - it should now work!
- Restart your terminal/IDE completely
- Try running the script as Administrator
- Check if
C:\msys64\ucrt64\binis in your PATH
- Install "App Installer" from Microsoft Store
- Update Windows to the latest version
- Run PowerShell as Administrator
- Or use
-UserOnlyflag for user-only installation
- Run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - Or use the batch script instead
If the scripts don't work, you can install manually:
- Download MSYS2 from: https://www.mingw-w64.org/
- Install MinGW-w64 toolchain
- Add
C:\msys64\ucrt64\binto your PATH
- MSYS2: Development environment for Windows
- MinGW-w64: Minimalist GNU for Windows (64-bit)
- GCC: GNU Compiler Collection
- g++: C++ compiler
- Supporting libraries: All necessary dependencies
After installation:
- MSYS2:
C:\msys64\ - Compiler:
C:\msys64\ucrt64\bin\g++.exe - Libraries:
C:\msys64\ucrt64\lib\ - Headers:
C:\msys64\ucrt64\include\
One-liner uninstall:
irm https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/uninstall.ps1 | iexLocal uninstall scripts:
# PowerShell script (recommended)
# Complete removal (removes MSYS2 and cleans PATH)
.\uninstall.ps1
# Remove from PATH only, keep MSYS2
.\uninstall.ps1 -KeepMSYS2
# System-wide removal (requires admin)
.\uninstall.ps1 -SystemWide
# Force removal without prompts
.\uninstall.ps1 -Force# Batch script (simple alternative)
uninstall.batIf the script doesn't work:
- Uninstall MSYS2 via Windows Settings β Apps
- Remove
C:\msys64\ucrt64\binfrom your PATH - Delete
C:\msys64directory if it remains
Copy this into PowerShell and press Enter:
irm https://raw.githubusercontent.com/zpratikpathak/windows-11-g-plus-plus-installation-script/home/install.ps1 | iexThen restart your terminal and test:
g++ --versionThat's it! π
These scripts are provided as-is for educational purposes. MinGW-w64 and GCC are licensed under their respective open-source licenses.