mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-28 19:00:52 +08:00
36 lines
692 B
Plaintext
36 lines
692 B
Plaintext
#exe {
|
|
-Mroot=main.zig
|
|
#}
|
|
|
|
#write main.zig {
|
|
const foo = @import("foo.zig");
|
|
pub fn main() !void {
|
|
try foo.hello();
|
|
}
|
|
#}
|
|
#write foo.zig {
|
|
const std = @import("std");
|
|
fn hello() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
|
|
}
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#}
|
|
#update
|
|
#check errors {
|
|
main.zig:3:12: error: 'hello' is not marked 'pub'
|
|
foo.zig:2:1: note: declared here
|
|
#}
|
|
|
|
#write foo.zig {
|
|
const std = @import("std");
|
|
pub fn hello() !void {
|
|
try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
|
|
}
|
|
const io = std.Io.Threaded.global_single_threaded.io();
|
|
#}
|
|
#update {
|
|
make hello pub#}
|
|
#check stdout {
|
|
Hello, World!
|
|
#}
|