Nearby lessons
6 of 124C - Installation
How to install C on your computer — what a compiler is, the three pieces you need (editor, compiler, extension), and which toolchain to pick on Windows, Linux and macOS.
What You Actually Need
C is a compiled language, so writing code is not enough — something has to translate it into a program the CPU can run. A working C setup has three parts:
| Piece | Job | Our choice |
|---|---|---|
| Editor | Where you type the code | Visual Studio Code |
| Compiler | Turns .c files into an executable | GCC (via MinGW-w64 on Windows) |
| Extension | Adds highlighting, IntelliSense and debugging | C/C++ by Microsoft |
Which Compiler for Your OS?
| Operating system | Compiler package | How to install |
|---|---|---|
| Windows | MinGW-w64 (GCC) | Download from winlibs.com or install MSYS2 |
| Ubuntu / Debian | GCC | sudo apt install build-essential |
| Fedora / RHEL | GCC | sudo dnf groupinstall "Development Tools" |
| macOS | Clang | xcode-select --install |
All of these accept the same standard C code. On macOS the command gcc actually runs Clang, which is fine for everything in this tutorial.
Check Whether You Already Have One
Before installing anything, open a terminal (Command Prompt, PowerShell or Terminal) and ask the compiler to report its version:
Reading the Result
- A version number means you are done — a compiler is installed and on your PATH.
'gcc' is not recognized...(Windows) orcommand not found(Linux/macOS) means you still need to install it, or it is installed but not on the PATH.
IDE or Editor + Compiler?
You have two routes. Both work; this tutorial uses the second.
| Route | Examples | Trade-off |
|---|---|---|
| All-in-one IDE | Code::Blocks, Dev-C++, CLion | Installs in one click, but hides how compiling works |
| Editor + compiler | VS Code + GCC | A few more steps, but you learn the real toolchain |
The next four lessons walk through the VS Code route one step at a time: install the editor, install the compiler, install the extension, configure it, then write and run your first program.
- You need an editor, a compiler, and (in VS Code) the C/C++ extension.
- Windows uses MinGW-w64 (gcc); Linux uses build-essential; macOS uses Xcode tools.
- gcc --version tells you whether a compiler is already installed.
- An IDE bundles all three pieces together; VS Code assembles them yourself.