0PricingLogin
Zig Academy · Lesson

Declaring Executables and Libraries

Add artifacts to the build graph.

Artifacts to Build

The things you compile are called artifacts: an executable you run, or a library other code links against. You declare them in build.zig. 📦

Add an Executable

Create a runnable program with addExecutable. You give it a name and the root source file that holds main.

const exe = b.addExecutable(.{
    .name = "app",
});

All lessons in this course

  1. Anatomy of a build.zig File
  2. Declaring Executables and Libraries
  3. Build Steps and zig build run
  4. Build Options and Flags
← Back to Zig Academy