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:

  1. Clean your existing build using:
    mingw32-make clean
  2. Change to the main Raylib source directory (src/)
  3. Build the library with the following to force a 64-bit build (or use x86 for a 32-bit build):
    mingw32-make RAYLIB_BUILD_ARCH=x64
  4. Now change to the examples directory and do the same:
    cd ../examples
    mingw32-make RAYLIB_BUILD_ARCH=x64

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.

 

P.S., Here's a direct link to Raylib's source-code (link).