Zig NEWS

Felix Orinda
Felix Orinda

Posted on

How to create a zig project

Assuming all that you already have zig already installed in your system and by this command you'll get a version

zig version
Enter fullscreen mode Exit fullscreen mode

Once you get an output showing that you have zig. Then now we need to initialize the project
Create a folder in your desired location and in that directory run the following command

zig init-exe
Enter fullscreen mode Exit fullscreen mode

This command will create a zig boilerplateproject for you and will contain the following folders

 -------
 |-src
 |  - main.zig
 |-zig-cache
 |  -...
 |-zig-out
 |  -bin
 |-build.zig
Enter fullscreen mode Exit fullscreen mode

By that you have a ready project structure. Just run

zig build to build your project or zig build run to build and run the project.

Discussion (0)