Page 1 of 1

Using Zeus with Zig

Posted: Fri Jan 01, 2021 12:26 pm
by jussij
1. Go to the following download page an select from the various versions of Zig available: https://ziglang.org/download/

In this example the 0.13.0 version zip file was downloaded from that page.

Code: Select all

zig-windows-x86_64-0.13.0.zip
2. Unzip the contents of that 0.13.0 zip file into a suitable folder location, for example.

Code: Select all

c:\zig\
The that folder will contain the Zig executable:

Code: Select all

zig.exe
NOTE: An alternative folder location can also be used. In addition if that folder location contains white space some extra care will be needed as the folder location will need to be wrapped in quotes. As such it is best to start with a folder location that does not contain white space.

3. Add the following folder location to the PATH environment variable:

Code: Select all

c:\zig\
More details about the PATH can be found here: http://www.zeusedit.com/phpBB3/viewtopic.php?f=5&t=6176

4. Start the Zeus IDE and check the PATH has been correctly configure by using the Tools, DOS Command Line menu to run the following command:

Code: Select all

zig version
Running that command should result in the following output:
0.13.0
If instead the following output is produced re-check the PATH settings as this output indicates that PATH setting is wrong:
'zig' is not recognized as an internal or external command, operable program or batch file.
5. Start Zeus and use the Options, Document Types menu to edit the Zig Document Type and in the Compiler section make sure the following compiler command is defined:

Code: Select all

zig build-exe "$fn"
Also check the capture output and capture error options.

6. Using the Zig documentation found here: https://ziglang.org/documentation/0.13.0/#Hello-World

Using the example found in the link above create a test.zig file containing the following code:

Code: Select all

const std = @import("std");

pub fn main() !void {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("Hello, {s}!\n", .{"world"});
}
7. With the test.zig file as the active window, use the Compiler, Compile menu to compile and link the code from this project to produce an executable.

8. With the test.zig file as the active window, use the Macros, Execute 'tast.exe' menu to run the executable file which should result in the following output:
Hello, world!
Cheers Jussi