GCC C Compiler
On this page (8sections)
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.
Frequently Asked Questions
What does this C program do?
It is a C example program that demonstrates GCC C Compiler, including the complete source code and the expected sample output.
How do I compile and run this C program?
Save the code in a `.c` file, compile it with `gcc filename.c -o program`, then run it with `./program` (or `program.exe` on Windows).
What concepts does this example use?
This example uses core C syntax, illustrating a common pattern in C programming.