One simple setup (w64devkit)
w64devkit is a tiny, portable toolchain for Windows that includes g++, make, and gdb. No installers, no extra shells.
1) Get the tools
- Download w64devkit (x86_64) zip (portable).:
Releases (pick thew64devkit-x86_64-<version>.zipasset):
https://github.com/skeeto/w64devkit/releases GitHub
Project page (docs/usage):
https://github.com/skeeto/w64devkit GitHub - Quick steps: download the x86_64 ZIP → extract to
C:\w64devkit→ addC:\w64devkit\binto your System Path → restart VS Code. (It includes GCC/G++, GDB, and GNU Make.) mingw-w64.org
2) Add to PATH (so VS Code can find g++/make)
- Press Win+R →
sysdm.cpl→ Advanced tab → Environment Variables… - Under System variables, select Path → Edit → New → add:
C:\w64devkit\bin - Click OK on all dialogs.
3) Restart VS Code and verify
- Open VS Code → Terminal → New Terminal (PowerShell is fine).
- Run:
g++ --version make --versionYou should see versions (no “not found” errors).
4) Quick test
- Create a folder (e.g.,
hello) with these two files.
main.cpp
#include <iostream>
int main() {
std::cout << "Hello from C++!\n";
return 0;
}
Code language: PHP (php)
Makefile (capital M)
CXX := g++
CXXFLAGS := -std=c++17 -Wall -Wextra -O2
TARGET := app
SRC := main.cpp
all: $(TARGET)
$(TARGET): $(SRC)
$(CXX) $(CXXFLAGS) $(SRC) -o $(TARGET)
clean:
rm -f $(TARGET).exe
Code language: JavaScript (javascript)
- In the VS Code terminal:
make .\app.exeOutput:Hello from C++!
Common gotchas (fast fixes)
g++ormakestill “not found”
You didn’t restart VS Code, orC:\w64devkit\binisn’t really in System PATH. Recheck the Path entry and reopen VS Code.- Makefile doesn’t “clean”
Userm -f app.exeexactly as shown (w64devkit includesrm). If you swapped it for Windowsdel, it may fail undermake.
That’s it. This route takes a couple of minutes and works in the default VS Code PowerShell terminal—no MSYS2 profiles, no extra shells.
