Using Zeus with Zig

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2547
Joined: Fri Aug 13, 2004 5:10 pm

Using Zeus with Zig

Post 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.9.1 version zip file was downloaded from that page.

Code: Select all

zig-windows-x86_64-0.9.1.zip
2. Unzip the contents of that 0.9.1 zip file into the following folder location.

Code: Select all

c:\zig-0.9.1\
The contents of that folder should look something like this:

Code: Select all

 Directory of C:\zig-0.9.1

06/04/2022  01:23 PM    <DIR>          .
06/04/2022  01:23 PM    <DIR>          ..
06/04/2022  01:23 PM    <DIR>          doc
06/04/2022  01:23 PM    <DIR>          lib
15/02/2022  12:47 PM             1,091 LICENSE
15/02/2022  12:47 PM       121,928,192 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-0.9.1\
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.9.1
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 make sure in the Compiler section the following compiler command has been defined:

Code: Select all

zig build-exe "$fn"
6. Using the Zig documentation found here: https://ziglang.org/documentation/0.9.0/#Hello-World

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 {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("Zig - 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 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
Post Reply