Zig NEWS

Discussion on: zig build explained - part 3

Collapse
 
kilianvounckx profile image
KilianVounckx • Edited

I have a build script for a library I am working on. It creates the library with

const lib = b.addSharedLibrary("my_library", "src/lib.zig", .unversioned);
lib.addPackage(.{
    .name = "interface",
    .path = .{ .path = "libs/interface.zig/interface.zig" },
});
Enter fullscreen mode Exit fullscreen mode

However when I try to use @import("interface") in src/lib.zig, the compiler says:

error: unable to find 'interface'
Enter fullscreen mode Exit fullscreen mode

Do you know what the reason could be? When I use the exact same addPackage call to an exe, it works just fine.