#What are modules? And how do i create them?

1 messages · Page 1 of 1 (latest)

winged coyote
#
    exe.addModule("gl", .{
        .source_file = .{ .path = "libs/gl.zig" },
        .dependencies = .{},
    });

Currently I have this but I get an error error: expected struct or union; found '*Build.Module'

#

I am using the master build of zig

#

I do not know what to put for FileSource generated member

#

What are modules? And how do i create them?

wraith saddle
#

Did you work it out?

A module is a tree of zig files with an main/entry-point file used to for importing like @import("module-name"); To make one in a build.zig you use either std.Build.createModule(), std.Build.addModule() or std.Build.CompileStep.addAnonymousModule(). The above snippet isn't quite enough to know what is going wrong, but it looks like you're trying to create a module by using std.Build.CompileStep.addModule(), which is not used for creating a module, but rather for making one accessible under a given name in another zig module. You'll either want to use addAnonymousModule() or create a module separately and then pass that instead of the anonymous struct in you snippet.