zig を使ってみました。
Ubuntu 24.04 にインストール
sudo snap install zig --classic --beta
バージョンの確認
$ zig version
0.13.0
プログラム
hello_world.zig
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("Hello, {s}!\n", .{"world"});
try stdout.writeAll("Zigg\n");
try stdout.writeAll("こんにちは\n");
try stdout.writeAll("今日は良い天気です。\n");
}
コンパイル
Makefile
hello_world: hello_world.zig
zig build-exe hello_world.zig
clean:
rm -f hello_world hello_world.o
make
$ make
zig build-exe hello_world.zig
実行
$ ./hello_world
Hello, world!
Zigg
こんにちは
今日は良い天気です。