Skip to content

[doc] Hello world example in website not work in 0.15.0-dev.888+79db39307 #497

@bronze1man

Description

@bronze1man

Zig Version

0.15.0-dev.888+79db39307

Steps to Reproduce and Observed Behavior

copy and paste hello-world.zig from https://ziglang.org/learn/samples/ into https://godbolt.org/ zig and zig trunk.

const std = @import("std");

pub fn main() !void {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("hello world!\n", .{});
}

got

./example.zig:4:26: error: root source file struct 'Io' has no member named 'getStdOut'
    const stdout = std.io.getStdOut().writer();
                   ~~~~~~^~~~~~~~~~
/opt/compiler-explorer/zig-master/lib/std/Io.zig:1:1: note: struct declared here
const std = @import("std.zig");
^~~~~
referenced by:
    callMain [inlined]: /opt/compiler-explorer/zig-master/lib/std/start.zig:681:37
    callMainWithArgs [inlined]: /opt/compiler-explorer/zig-master/lib/std/start.zig:641:20
    posixCallMainAndExit: /opt/compiler-explorer/zig-master/lib/std/start.zig:596:36
    2 reference(s) hidden; use '-freference-trace=5' to see all references
Compiler returned: 1

The page of https://ziglang.org/learn/samples/ do not say it works on which version of zig.

Expected Behavior

output Hello, World!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions