A few weeks ago I decided to check out Raylib, an open-source game engine written in C. It's different from other game engines such as Unity, Unreal, or Godot, because it has no editor to build levels and write scripts. Raylib has only the game engine core, and you build your game using that and C/C++ (or other languages; it has bindings for many).
Anyway, I wanted to evaluate it for possible future use, but encountered the following error when building the examples on Windows:
skipping incompatible ../src\libraylib.a when searching for -lraylib
Searching the internet gave no clear solutions. So, for everyone's benefit (including me), here's how to work around the problem:
- Clean your existing build using:
- Change to the main Raylib source directory (src/)
- Build the library with the following to force a 64-bit build (or use x86 for a 32-bit build):
- Now change to the examples directory and do the same:
How This Works
The problem is that I have TDM GCC installed, which can compile both 32-bit and 64-bit binaries. For some reason, Raylib's library and examples default to different architectures, resulting in the "incompatible library" problem. The fix above forces both to be built with the same architecture.