| This repository gathers Zig code examples coming from various websites and books. It also includes several build scripts (batch files, Make scripts) for experimenting with Zig on a Windows machine. |
Ada, Akka, C++, COBOL, Component Pascal, Dafny, Dart, Deno, Docker, Flix, Go, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, Standard ML, TruffleSqueak and WiX Toolset are other topics we are continuously monitoring.
This project depends on two external software for the Microsoft Windows platform:
Optionally one may also install the following software:
- ConEmu 2023 (release notes)
- SDL 2 (release notes)
- SDL 3.3 (release notes)
- Visual Studio Code 1.98 (release notes)
- Zig 0.16 DEV
🔎 Git for Windows provides a BASH emulation used to run
gitfrom the command line (as well as over 250 Unix commands likeawk,diff,file,grep,more,mv,rmdir,sedandwc).
For instance our development environment looks as follows (October 2025) 1:
C:\opt\ConEmu\ ( 26 MB) C:\opt\Git\ (393 MB) C:\opt\SDL2\ ( 21 MB) C:\opt\SDL3\ ( 49 MB) C:\opt\zig-0.15.2\ (293 MB) C:\opt\zig-0.16.0-dev\ (269 MB) C:\opt\VSCode\ (371 MB)
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\as the installation directory for optional software tools (similar to the/opt/directory on Unix).
Directory structure ▴
This project is organized as follows:
bin\*.bat
docs\
examples\{README.md, hello}
sdl-examples\{README.md, hello-gamedev, hello-gamedev-sdl3}
README.md
RESOURCES.md
setenv.bat
where
- directory
bin\provides several utility batch files. - directory
docs\contains Zig related papers/articles. - directory
examples\contains Zig code examples (seeREADME.md). - file
README.mdis the Markdown document for this page. - file
RESOURCES.mdis the Markdown document presenting external resources. - file
setenv.batis the batch script for setting up our environment.
We also define a virtual drive – e.g. drive H: – in our working environment in order to reduce/hide the real path of our project directory (see article "Windows command prompt limitation" from Microsoft Support).
🔎 We use the Windows external command
substto create virtual drives; for instance:> subst H: %USERPROFILE%\workspace\zig-examples
In the next section we give a brief description of the batch files present in this project.
Batch commands ▴
We execute command setenv.bat once to setup our development environment:
> setenv Tool versions: zig 0.15.2, make 4.4.1, SDL2 2.32.10.0, SDL3 3.3.2.0, git 2.51.1, diff 3.12, bash 5.2.37(1)
Usage examples ▴
Command setenv.bat with option -verbose displays additional information:
- the tool paths (which may not contain the version suffix, i.e.
C:\opt\Git\bin\git.exein some installations), - the environment variables defined locally within this session,
- and the path associations (i.e.
H:\in this case, but other drive names may be displayed as path associations are globally defined).
> setenv -verbose Tool versions: zig 0.15.2, make 4.4.1, cmake 4.2.0-rc1, SDL2 2.32.10.0, SDL3 3.3.2.0, git 2.51.1, diff 3.11, bash 5.2.37(1) Tool paths: C:\opt\zig-0.15.2\zig.exe C:\opt\msys64\usr\bin\make.exe C:\opt\Git\bin\git.exe C:\opt\Git\usr\bin\diff.exe C:\opt\Git\bin\bash.exe Environment variables: "GIT_HOME=C:\opt\Git" "MSYS_HOME=C:\opt\msys64" "SDL2_HOME=C:\opt\sdl2" "SDL3_HOME=C:\opt\sdl3" "ZIG_HOME=C:\opt\zig-0.15.2" Path associations: H:\: => %USERPROFILE%\workspace-perso\zig-examples
Footnotes ▴
[1] Downloads ↩
- In our case we downloaded the following installation files (see section 1):
-
ConEmuPack.230724.7z ( 5 MB) PortableGit-2.51.1-64-bit.7z.exe ( 41 MB) SDL2-devel-2.32.10-VC.zip ( 6 MB) SDL3-devel-3.3.2-VC.zip ( 13 MB) VSCode-win32-x64-1.98.2.zip (131 MB) zig-windows-x86_64-0.15.2.zip ( 75 MB) zig-x86_64-windows-0.16.0-dev.747+493ad58ff.zip ( 79 MB)