Created
January 2, 2026 09:00
-
-
Save GeroZayas/42b7e0057a5f3adf70c523a4d954d0ec to your computer and use it in GitHub Desktop.
Compile RAYLIB App with Zig (C99)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zig cc -std=c99 main.c \ | |
| -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 \ | |
| -o app |
Author
Author
-o app
Name the output executable app.
Without -o, Zig would pick a default name.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Linker flags (-l...)
These tell the linker what libraries to include when producing the final executable.
-lraylib
Link Raylib library itself (the implementation for all those functions like InitWindow).
You installed Raylib earlier via make && sudo make install.
GitHub
-lGL
Link OpenGL (graphics). Raylib uses OpenGL for rendering.
On Ubuntu this comes from packages like libgl1-mesa-dev.
GitHub
-lm
Link math library (libm). Functions like sin/cos come from here.
-lpthread
Link POSIX threads (multithreading). C runtime needs this for some systems.
-ldl
Link dynamic loader helper. Required for loading shared modules at runtime.
-lrt
Link real-time extensions, e.g., high-precision timers.
-lX11
Link X11 window system.
Raylib opens a window using X11 on Linux, so you need the X11 libs (libx11-dev).