Skip to content

website build-system static-library referencing non existant std.io members #572

@ttambow

Description

@ttambow

literally this. https://codeberg.org/ziglang/zig/issues/30211

Zig Version

n/a - this is about your website
Steps to Reproduce and Observed Behavior

hi there,

sorry i don't know where else to raise this. i asked on discord and they said to raise here.

specifically the build-system and static library is out of date: https://ziglang.org/learn/build-system/#static-library

tested on master, 0.15.1, and 0.15.2; issue is thus.

install
└─ install demo
   └─ compile exe demo Debug native 2 errors
src/demo.zig:7:11: error: unused local constant                                                                                                                                                                             
    const stdout = std.io.getStdOut();
          ^~~~~~
src/demo.zig:7:26: error: root source file struct 'Io' has no member named 'getStdOut'                                                                                                                                      
    const stdout = std.io.getStdOut();
                   ~~~~~~^~~~~~~~~~
/home/thomas/Downloads/zig-x86_64-linux-0.15.1/lib/std/Io.zig:1:1: note: struct declared here                                                                                                                               
const builtin = @import("builtin");

this is the code:

const std = @import("std");

extern fn fizzbuzz(n: usize) ?[*:0]const u8;

pub fn main() !void {
    const writer = std.io.Writer;
    const stdout = std.io.getStdOut();
    var bw = std.io.bufferedWriter(writer());
    const w = bw.writer();
    for (0..100) |n| {
        if (fizzbuzz(n)) |s| {
            try w.print("{s}\n", .{s});
        } else {
            try w.print("{d}\n", .{n});
        }
    }
    try bw.flush();
}

looks like bufferedWriter doesnt exist, either

Expected Behavior

For it to work, of course.

and one clarifying comment i felt compelled to make:

hi all - im not looking for the answer; im here to report that your documentation is out of date.

if it's a feature of 15.0, but was removed since, then the learning page needs to be updated with what is the recommended/standard approach here.

the point of the page is to learn, and with obstructions like this it does not install a lot of trust in the language.

again, if this is not the correct place to raise this please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions