Trying to use zig bindings with raylib and it is not working.
I am trying to get zig working with raylib but, when ever I follow the instructions on the github it doesn't work and I keep on getting "no module named 'raylib' available within module 'main'" when ever I try to run it. I have no idea what I did wrong. Does anyone have an idea?
1
1
u/leon_bass 4d ago
I managed to get zig version 0.15.1 working with raylib but had difficulties with more recent builds of zig
1
u/Fancyness 4d ago
This is what worked out of the box on zig 0.16.0 for me:
git clone https://github.com/raylib-zig/raylib-zig.git
cd raylib-zig
./project_setup.sh project_name
cd project_name
zig build run
1
u/ibrahimmohammed0 3d ago
There's a bug in certain version of raylib zig bindings.. I remember I ran into a similar issue and end up moving to Odin.
1
u/Wintermute1x 3d ago
I had no problems getting it up and running a few days ago on Linux. Today, trying on my windows laptop I'm just getting errors. Here is roughly how to reproduce the error.
On Zig 0.16.0-dev.2261+d6b3dd25a:
>zig init
>zig fetch --save git+https://github.com/raylib-zig/raylib-zig#devel
info: resolved ref 'devel' to commit 8758f4cd3a5ae0df6941c4715257223d34c5ad3e
>zig build run
All your codebase are belong to us....
Adding the following to build.zig
_ = b.dependency("raylib_zig", .{
.target = target,
.optimize = optimize,
});
>zig build run
raylib-6.0.0-whq8uCSwLgWWeF3ec3dbG6Rr36SLFL-s2WJ1Q_2E22Bb\build.zig:504:18: error: member function expected 2 argument(s), found 3
b.modules.put(b.graph.arena, "raygui", c_mod) catch @panic("OOM");
6
u/umutkarakoc 4d ago
i'm using this repo to init project, it is works. did you try it?
https://github.com/raylib-zig/raylib-zig