-
Zig연습] Cannot use std.io.getStdOut() inside non-main function코딩Coding/Zig_❤️lang_연습 2022. 8. 9. 21:34728x90
const std = @import("std"); fn output(stream: *std.io.FileOutStream.Stream, s: []const u8) !void { return stream.print("Hello world__Zig\n {}\n", s); } pub fn main() !void { var stdout_file = try std.io.getStdOut(); var stdout_stream = std.io.FileOutStream.init(stdout_file); var stdout = &stdout_stream.stream; try output(stdout, "foo"); }
zig run 026_hello2.zig ./026_hello2.zig:8:43: error: expected error union type, found 'std.fs.file.File' var stdout_file = try std.io.getStdOut();
https://github.com/ziglang/zig/issues/1587
반응형'코딩Coding > Zig_❤️lang_연습' 카테고리의 다른 글
zig연습)zig 에러4 마지막에 막힘 (0) 2022.08.05