0PricingLogin
Zig Academy · Lesson

Cross-Compiling C with zig cc

Use Zig as a portable C compiler.

Zig Is Also a C Compiler

Beyond Zig code, the toolchain includes a full C compiler. The zig cc command behaves like a drop-in for gcc or clang.

zig cc main.c -o app

Cross-Compile C Too

The same -target flag works for C. You can build a C program for another platform with zig cc from any host.

zig cc -target aarch64-linux-musl main.c -o app

All lessons in this course

  1. Targets and the -target Triple
  2. Build for Linux, macOS, and Windows
  3. Cross-Compiling C with zig cc
  4. Static Binaries and musl
← Back to Zig Academy