ziglang/ziglang.org
14
29
Fork
You've already forked ziglang.org
31

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

Open
opened 2025年07月13日 06:28:25 +02:00 by bronze1man · 0 comments
bronze1man commented 2025年07月13日 06:28:25 +02:00 (Migrated from github.com)
Copy link

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!

### 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!
Sign in to join this conversation.
No Branch/Tag specified
main
release-0.16.0
apraga/french
homersimpsons/fix/mobile-responsiveness
MarkLagodych/patch-1
Zirunis/patch-1
zmitchell/zmitchell/build-graph-docs
generalmimon/fix-unit-testing-examples
generalmimon/fix-code-snippet-in-0.15.1-relnotes
TheConnorJohnson/main
meeting-minutes
enkvadrat/update-curl-example
No results found.
Labels
Clear labels
bounty
https://ziglang.org/news/announcing-donor-bounties
bug
Observed behavior contradicts documented or intended behavior.
contributor-friendly
This issue is limited in scope and/or knowledge of project internals.
downstream
An issue with a third-party project that uses this project.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
infra
An issue related to project infrastructure, e.g. continuous integration.
optimization
A task to improve performance and/or resource usage.
question
No questions on the issue tracker; use a community space instead.
regression
Something that used to work in a previous version stopped working
upstream
An issue with a third-party project that this project uses.
use case
Describes a real use case that is difficult or impossible, but does not propose a solution.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/ziglang.org#497
Reference in a new issue
ziglang/ziglang.org
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?