1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-24 00:02:09 +02:00
tldr/pages/common/zig.md

730 B

zig

The Zig compiler and toolchain. More information: https://ziglang.org.

  • 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 and windows 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}}