Hello,
Why "Hello, World" won't works in real!
I copy source-code from this page:
https://ziglang.org/documentation/master/#toc-Hello-World
0.6.0
const print = @import("std").debug.print;
pub fn main() void {
print("Hello, world!\n", .{});
}
./h.zig:1:35: error: container 'std.debug' has no member called 'print'
const print = @import("std").debug.print;
^
./h.zig:4:5: note: referenced here
print("Hello, world!\n", .{});
^
https://github.com/ziglang/zig/blob/c3e0224792510e69763dbc6ba68794f9134925f2/lib/std/debug.zig#L61
const print = @import("std").debug.warn;
pub fn main() void {
print("Hello, world!\n", .{});
}
https://github.com/ziglang/zig/blob/c3e0224792510e69763dbc6ba68794f9134925f2/lib/std/debug.zig#L57
Hello, world!
Finally, It's one problem in document or a bug in compiler?
Regards,
Max Base
Hello Max,
It looks like you're using zig version 0.6.0 but referring to the documentation for the master branch. You can find the docs for the 0.6.0 release here: https://ziglang.org/documentation/0.6.0/. On the master branch std.debug.warn has been deprecated in favor of std.debug.print as you seem to have realized.
Cheers,
Isaac Freund
Thanks you, and sorry for my mistake. :+1:
Most helpful comment
Hello Max,
It looks like you're using zig version
0.6.0but referring to the documentation for the master branch. You can find the docs for the0.6.0release here: https://ziglang.org/documentation/0.6.0/. On the master branchstd.debug.warnhas been deprecated in favor ofstd.debug.printas you seem to have realized.Cheers,
Isaac Freund