zig - Man Page
manual page for zig 0.13.0
Examples (TL;DR)
- Compile the project in the current directory:
zig build
- Compile and run the project in the current directory:
zig build run
- Initialize a
zig build
project with library and executable:zig init
- Create and run a test build:
zig test path/to/file.zig
- Cross compile, build and run a project for
x86_64
architecture andwindows
operating system:zig build run -fwine -Dtarget=x86_64-windows
- Reformat Zig source into canonical form:
zig fmt path/to/file.zig
- Translate a C file to
zig
:zig translate-c -lc path/to/file.c
- Use Zig as a drop-in C++ compiler:
zig c++ path/to/file.cpp
Synopsis
zig [command] [options]
Description
Commands:
- build
Build project from build.zig
- fetch
Copy a package into global cache and print its hash
- init
Initialize a Zig package in the current directory
- build-exe
Create executable from source or object files
- build-lib
Create library from source or object files
- build-obj
Create object from source or object files
- test
Perform unit testing
- run
Create executable and run immediately
- ast-check
Look for simple compile errors in any set of files
- fmt
Reformat Zig source into canonical form
- reduce
Minimize a bug report
- translate-c
Convert C code to Zig code
- ar
Use Zig as a drop-in archiver
- cc
Use Zig as a drop-in C compiler
- c++
Use Zig as a drop-in C++ compiler
- dlltool
Use Zig as a drop-in dlltool.exe
- lib
Use Zig as a drop-in lib.exe
- ranlib
Use Zig as a drop-in ranlib
- objcopy
Use Zig as a drop-in objcopy
- rc
Use Zig as a drop-in rc.exe
- env
Print lib path, std path, cache directory, and version
- help
Print this help and exit
- std
View standard library documentation in a browser
- libc
Display native libc paths file or validate one
- targets
List available compilation targets
- version
Print version number and exit
- zen
Print Zen of Zig and exit
General Options:
- -h, ā--help
Print command-specific usage