Setup for C++ on Windows 11 + VS Code

C++ on Windows 11 + VS Code (with make)

1) Install VS Code

  • Download from code.visualstudio.com and install with defaults.
  • In VS Code, install extensions:
    • C/C++ (Microsoft)
    • (Optional) C/C++ Extension Pack

2) Install MinGW-w64 (GCC/G++)

  • Get the WinLibs MinGW-w64 build (UCRT, 64-bit, latest GCC zip).
  • Extract to: C:\mingw64
    • You should have C:\mingw64\bin\g++.exe and ...\bin\mingw32-make.exe.

3) Add MinGW to PATH

  1. Start → “Edit the system environment variables” → Environment Variables…
  2. Under System variables → select PathEditNew → add: C:\mingw64\bin
  3. OK → OK → OK. Close & reopen VS Code (or sign out/in).

4) Add make (choose ONE option)

Option A — Quick shim using WinLibs’ mingw32-make

WinLibs already includes mingw32-make.exe. Make it invokable as make:

Method 1 (copy/rename):

  • Open C:\mingw64\bin
  • Copy mingw32-make.exe → paste as make.exe (same folder).

Method 2 (batch shim, no duplication):

  • Create a file C:\mingw64\bin\make.bat with this content: @echo off "%~dp0mingw32-make.exe" %*

Either method makes make work in any terminal.

Option B — Install standalone make via Chocolatey

If you prefer a package manager:

  1. Install Chocolatey (admin PowerShell):
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
  1. Install make:
choco install make -y

(If you use Scoop instead: iwr get.scoop.sh -useb | iex, then scoop install make.)

Tip: If make from Chocolatey lands earlier in PATH than MinGW, that’s fine—make will still call g++ from C:\mingw64\bin since it’s also on PATH.


5) Test in VS Code terminal

Open a new terminal in VS Code (PowerShell or cmd):

g++ --version
make --version

You should see GCC and GNU Make versions. If make fails, re-check PATH or complete Option A/B above.


6) Hello + Makefile sanity check

Create a folder, add these two files:

main.cpp

#include <iostream>
int main() {
    std::cout << "Hello, Make + MinGW!" << std::endl;
    return 0;
}

Makefile

CXX      := g++
CXXFLAGS := -O2 -std=c++17 -Wall -Wextra
TARGET   := hello
SRC      := main.cpp

$(TARGET): $(SRC)
	$(CXX) $(CXXFLAGS) -o $(TARGET) $(SRC)

run: $(TARGET)
	./$(TARGET)

clean:
	- del $(TARGET).exe 2> NUL

Then run:

make
make run
make clean

7) (Optional) VS Code tasks

If you want Ctrl+Shift+B to build with make, add .vscode/tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "make build",
      "type": "shell",
      "command": "make",
      "group": "build",
      "problemMatcher": ["$gcc"]
    },
    {
      "label": "make run",
      "type": "shell",
      "command": "make run"
    },
    {
      "label": "make clean",
      "type": "shell",
      "command": "make clean"
    }
  ]
}

Common hiccups

  • make not found: open a new terminal after changing PATH; verify C:\mingw64\bin is listed; use Option A or B above.
  • Spaces in paths: avoid extracting MinGW to paths with spaces.
  • Antivirus prompts: allow the MinGW folder.

That’s it—now you’ve got GCC, VS Code, and make working nicely on Windows.

Old Instructions below:

1. Install VS Code


2. Install MinGW-w64 (the GCC/G++ compiler for Windows)

  • Go to: WinLibs MinGW-w64 builds
    (or MSYS2 if you want more, but WinLibs is simpler).
  • Download the UCRT64, 64-bit, GCC + G++ zip. (Scroll down to the releases section and download the top entry (GCC 15.2.0) Win64 zip archive.
  • Extract it to something simple, e.g.: C:\mingw64
  • Inside you should see bin\g++.exe.

3. Add MinGW to PATH

  • Open Start → Edit the system environment variables.
  • Click Environment Variables.
  • Under System variables, select Path → Edit → New.
  • Add: C:\mingw64\bin
  • Click OK, OK, OK.
  • Close/reopen VS Code (or reboot).

👉 Test it: open a new terminal in VS Code → run:

g++ --version

If you see GCC info, you’re ready.

Scroll to Top