gcc

Preprocess and compile C and C++ source files, then assemble and link them together. More information: <https://gcc.gnu.org>.

Install

All systems
curl cmd.cat/gcc.sh
Debian Debian
apt-get install gcc
Ubuntu
apt-get install gcc
Alpine
apk add gcc
Arch Arch Linux
pacman -S gcc
image/svg+xml Kali Linux
apt-get install gcc
CentOS
yum install gcc
Fedora
dnf install gcc
Windows (WSL2)
sudo apt-get update sudo apt-get install gcc
OS X
brew install gcc
Raspbian
apt-get install gcc
Docker
docker run cmd.cat/gcc gcc powered by Commando

Preprocess and compile C and C++ source files, then assemble and link them together. More information: <https://gcc.gnu.org>.

  • Compile multiple source files into an executable:
    gcc path/to/source1.c path/to/source2.c ... -o path/to/output_executable
  • Show common warnings, debug symbols in output, and optimize without affecting debugging:
    gcc path/to/source.c -Wall -g -Og -o path/to/output_executable
  • Include libraries from a different path:
    gcc path/to/source.c -o path/to/output_executable -Ipath/to/header -Lpath/to/library -llibrary_name
  • Compile source code into Assembler instructions:
    gcc -S path/to/source.c
  • Compile source code into an object file without linking:
    gcc -c path/to/source.c
  • Optimize the compiled program for performance:
    gcc path/to/source.c -O1|2|3|fast -o path/to/output_executable

© tl;dr; authors and contributors