-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
I have been puzzling on using this library for a good couple of hours because I kept on getting the errors about not linking the functions from the learn_opengl.exe.obj:
run
└─ run learn_opengl
└─ zig build-exe learn_opengl Debug native 8 errors
error: lld-link: undefined symbol: glfwTerminate
note: referenced by C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\src\main.zig:41
note: C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\.zig-cache\o\b2ec2d1bc7eaaef8f4ec186984fc35e5\learn_opengl.exe.obj:(main.main)
note: referenced by C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\src\main.zig:41
note: C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\.zig-cache\o\b2ec2d1bc7eaaef8f4ec186984fc35e5\learn_opengl.exe.obj:(main.main)
error: lld-link: undefined symbol: glfwDestroyWindow
note: referenced by C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\src\main.zig:48
note: C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\.zig-cache\o\b2ec2d1bc7eaaef8f4ec186984fc35e5\learn_opengl.exe.obj:(main.main)
error: lld-link: undefined symbol: glfwPollEvents
note: referenced by C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\src\main.zig:53
note: C:\Users\<users>\My Stuff\7_SoftwareDevelopment\zig\learn_opengl\.zig-cache\o\b2ec2d1bc7eaaef8f4ec186984fc35e5\learn_opengl.exe.obj:(main.main)
.
.
.
and so on...
After having a look to the zig-gamedev samples you have suggested, it seems that the Getting Started section missed to link the library, which the following solution works:
const zglfw = b.dependency("zglfw", .{});
exe_mod.addImport("zglfw", zglfw.module("root"));
exe.linkLibrary(zglfw.artifact("glfw")); // <-- This is the missing line from the example
Metadata
Metadata
Assignees
Labels
No labels