GCC C Compiler
On this page (7sections)
GNU GCC Compiler
The GNU Compiler Collection (GCC) is the standard C compiler on Linux and macOS, and the recommended choice for modern C development on Windows via MinGW-w64 through MSYS2.
Official resources
- GCC home: https://gcc.gnu.org/
- GCC releases and source: https://gcc.gnu.org/releases.html
- MinGW-w64 (Windows): https://www.mingw-w64.org/
Windows — MSYS2 + MinGW-w64 (recommended)
- Download and install MSYS2 from https://www.msys2.org/
- Open MSYS2 UCRT64 from the Start menu
- Update packages:
pacman -Syu - Install GCC:
pacman -S mingw-w64-ucrt-x86_64-gcc - Verify:
gcc --version
To use gcc from Command Prompt or PowerShell, add C:\msys64\ucrt64\bin to your Windows PATH (adjust if you installed MSYS2 elsewhere).
For a full toolchain (make, gdb, etc.): pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
Linux
Most distributions include GCC in their package manager:
- Debian / Ubuntu:
sudo apt install build-essential - Fedora:
sudo dnf install gcc - Arch:
sudo pacman -S base-devel
Verify with gcc --version.
macOS
Install Xcode Command Line Tools (includes Clang, which supports C). For GCC specifically, install via Homebrew: brew install gcc
Quick test
#include <stdio.h>
int main(void) {
printf("Hello, C!\n");
return 0;
}
Compile: gcc hello.c -o hello then run ./hello (or hello.exe on Windows).
Related Pages
- C Downloads — Browse all C Downloads.
- Turbo C Compiler — More in c compilers.
- Download Turbo C and C++ IDE for Windows 7 and Windows 10 — More in c compilers.