Why I Started Using This Tool
I wanted something lean: write code, hit compile, see it run. VS Code with a proper GCC setup turned out to be exactly that. The catch? Getting the toolchain wired up on Windows is not obvious. This post is the guide I wish I had.
What It Does
This setup gives you a lightweight C development environment inside VS Code using MinGW-w64 (the GCC compiler for Windows, installed via MSYS2) and the official C/C++ extension from Microsoft.
- IntelliSense — autocomplete, error highlighting, and hover docs as you type, so you catch mistakes before compiling
- One-click build tasks — VS Code's
tasks.jsonlets you compile with Ctrl+Shift+B, no terminal wrangling required - Integrated terminal — run your compiled binary right inside VS Code without switching windows
Setup: Step by Step
Step 1
Verify your compiler path
You already have MSYS2 installed. Open a regular Windows terminal (not MSYS2) and confirm GCC is accessible:
gcc --version
If that returns an error, add both paths to your Windows system PATH:
C:\msys64\ucrt64\binC:\msys64\mingw64\bin
Go to System Properties → Environment Variables → Path → Edit → New and paste each one. Restart your terminal afterward.
Step 2
Install the C/C++ extension in VS Code
Open VS Code, press Ctrl+Shift+X, search for C/C++ (publisher: Microsoft), and click Install. This adds IntelliSense and debugging support.
Step 3
Create your Hello World file
Open a new folder in VS Code (File → Open Folder), then create a file called hello.c:
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
Step 4
Configure a build task
Press Ctrl+Shift+P → type Tasks: Configure Default Build Task → select C/C++: gcc.exe build active file. VS Code will create a .vscode/tasks.json automatically.
Confirm the compiler path inside tasks.json points to your installation:
"command": "C:\\msys64\\ucrt64\\bin\\gcc.exe"
Step 5
Compile and run
With hello.c open, press Ctrl+Shift+B to compile. This produces hello.exe in the same folder. Then open the integrated terminal (Ctrl+`) and run:
.\hello.exe
You should see:
Hello, World!
My Honest Pros & Cons
What I love
- Stays completely out of your way — no project files, no wizard dialogs, no bloat
- UCRT64 toolchain is modern and produces clean Windows-native binaries
- IntelliSense makes learning C much faster — you see what's wrong as you type, not after compiling
What could be better
- The PATH setup on Windows is genuinely fiddly — one wrong character in the path and nothing works, with an unhelpful error message
- Debugging requires a separate
launch.jsonconfig — it is not set up automatically, so stepping through code takes an extra round of config
Pricing: Is It Worth It?
Everything here is free and open source. VS Code is free. MSYS2 and GCC are free. The C/C++ extension is free. There are no paid tiers, no trials, no accounts required.
My take: Zero cost, professional-grade toolchain — this is the best free C setup available on Windows.
Final Verdict
Use this if you are learning C, working through a systems programming course, or want a fast and minimal environment without a heavyweight IDE. The one-time PATH setup is the only real friction — once that is done, the workflow is smooth and repeatable.
Skip this if you need integrated debugging out of the box from day one, or you are working on a large multi-file project — in those cases, a full IDE like CLion or Visual Studio Community will save you more configuration time.