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:

In this example the 0.5.0 version was installed from that release downloaded page.

2. Unzip the contents of that 0.5.0 package into this folder location.

Code: Select all

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

More details about the PATH can be found here:

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:
If instead the following output is produced re-check the PATH settings as this output indicates the PATH setting is wrong:
'zig' is not recognized as an internal or external command, operable program or batch file.
5. Using the Options, Document Types menu edit the Zig Document Type and in the Compiler section enter in the following compiler command:

Code: Select all

zig build-exe "$fn"
6. Using the Zig documentation found here:

Create a new test.zig file in the c:\temp folder using the following code:

Code: Select all

const std = @import("std");

pub fn main() !void {
    // If this program is run without stdout attached, exit with an error.
    const stdout_file = try;
    // If this program encounters pipe failure when printing to stdout, exit
    // with an error.
    try stdout_file.write("Zig - Hello, world!\n");
7. With the test.zig file as the active window, use the Compiler, Compile menu to compile and link the code to produced an executable.

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