I am trying to link with raylib in ./raylib-6.0 folder (relative to root) and using the recommened release notes 0.16 translate-c
I have:
zig version→ 0.16.0- project is fresh
zig init ./raylib-6.0/liband./raylib-6.0/includefolders in the root directory- modified
build.zigfromzig initto match the release notes. Here is the modified section (with comments removed)
const translate_c = b.addTranslateC(.{
.root_source_file = b.path("src/c.h"),
.target = target,
.optimize = optimize,
});
const translate_c_mod = translate_c.createModule();
translate_c_mod.addLibraryPath(b.path("./raylib-6.0/lib"));
translate_c_mod.addIncludePath(b.path("./raylib-6.0/include"));
translate_c.linkSystemLibrary("raylib", .{});
translate_c.linkSystemLibrary("raylib", .{});
const exe = b.addExecutable(.{
.name = "raylib_demo",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "raylib_demo", .module = mod },
.{
.name = "c",
.module = translate_c_mod,
},
},
}),
});
I get the error unable to find dynamic system library 'raylib' using strategy 'paths_first'. searched paths and list of system folders that doesn’t include ./raylib-6.0/*.
I also tried b.addSearchPrefix since I don’t know what it does and the name suggests that zig build uses it to search for libraries (like --search-prefix and option too didn’t work)
Any suggestion for a solution to modify the list zig searches? I know I can just put raylib in /usr/local/lib but it bothers me that I don’t understand why it is not working