I want to use raylib, which I have extracted to a folder thats part of my projects file system itself, but I don't know how.
Code:
const std = @import("std");
const ray = @cImport({
@cInclude("/home/markus/Development/zig/bouncy_balls/lib/raylib-4.5.0_linux_amd64/include/raylib.h");
});
const SCREEN_WIDTH = 16 * 5;
const SCREEN_HEIGHT = 9 * 5;
pub fn main() !u8 {
ray.InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib test");
defer ray.CloseWindow();
std.time.sleep(std.time.ns_per_s);
return 0;
}
build.zig:
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "bouncy_balls",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.linkLibC();
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| run_cmd.addArgs(args);
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}
error:
error: ld.lld: undefined symbol: InitWindow
note: referenced by main.zig:10
note: /home/markus/Development/zig/bouncy_balls/zig-cache/o/d10e83d63dbc8d4aeee25e25abdef346/bouncy_balls.o:(main.main)
error: ld.lld: undefined symbol: CloseWindow
note: referenced by main.zig:11
note: /home/markus/Development/zig/bouncy_balls/zig-cache/o/d10e83d63dbc8d4aeee25e25abdef346/bouncy_balls.o:(main.main)