tldr/pages/common/zig.md

37 lines
606 B
Markdown
Raw Normal View History

2021-09-24 06:04:28 +01:00
# 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` application:
`zig init-exe`
2022-06-30 20:57:34 +01:00
- Initialize a `zig build` library:
2021-09-24 06:04:28 +01:00
`zig init-lib`
- Create and run a test build:
`zig test {{path/to/file.zig}}`
- Reformat Zig source into canonical form:
`zig fmt {{path/to/file.zig}}`
- Use Zig as a drop-in C compiler:
`zig cc {{path/to/file.c}}`
- Use Zig as a drop-in C++ compiler:
`zig c++ {{path/to/file.cpp}}`