Nearby lessons

6 of 124

C - 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:

PieceJobOur choice
EditorWhere you type the codeVisual Studio Code
CompilerTurns .c files into an executableGCC (via MinGW-w64 on Windows)
ExtensionAdds highlighting, IntelliSense and debuggingC/C++ by Microsoft
In simple words: the editor is your notebook, the compiler is the translator, and the extension is the assistant that catches your mistakes as you type.

Which Compiler for Your OS?

Operating systemCompiler packageHow to install
WindowsMinGW-w64 (GCC)Download from winlibs.com or install MSYS2
Ubuntu / DebianGCCsudo apt install build-essential
Fedora / RHELGCCsudo dnf groupinstall "Development Tools"
macOSClangxcode-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:

Example03
CCode Cell
1gcc --version
Output
gcc (MinGW-w64 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.

Reading the Result

  • A version number means you are done — a compiler is installed and on your PATH.
  • 'gcc' is not recognized... (Windows) or command not found (Linux/macOS) means you still need to install it, or it is installed but not on the PATH.
Trainer's Note: "Not on the PATH" is the single most common setup problem. The compiler exists on disk, but the terminal does not know where to find it. The Install C Compiler lesson covers exactly how to fix that.

IDE or Editor + Compiler?

You have two routes. Both work; this tutorial uses the second.

RouteExamplesTrade-off
All-in-one IDECode::Blocks, Dev-C++, CLionInstalls in one click, but hides how compiling works
Editor + compilerVS Code + GCCA 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.

📝 Key Takeaways
  • 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.

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3