#error: root struct of file 'subfolder.sub' has no member named 'name'

1 messages · Page 1 of 1 (latest)

cerulean trail
#

you're defining struct members but you should be defining decls

#

const name: [:0]const u8 = "Hello from src/root.zig"; <- like that

karmic nest
#

why i cannot access file-container' s field?

cerulean trail
#

because it's a field of a struct

karmic nest
#

other zig libraries have fields

cerulean trail
#
const root = struct {
    name: [:0]const u8 = "Hello from src/root.zig",
};

test "example" {
    print(root.name); // ← you can't do this because you're accessing the field on the type
    const myroot: root = .{};
    print(myroot.name); // ← this works
}
karmic nest
#

oh i see

#

now