Problem during compilation

Hi, I'm a student and recently i've discovered this fantastic library, I find it easy and immediate.
I have a problem while compiling the library, are on Ubuntu 14.04 and this is the logs:
I really hope to get help!


  • Hello LelixSuper,

    Thanks for the complimnets! :smile: The problem seems to be that OpenGL libraries are not found in your Linux distribution; they are required to compile raylib.

    To solve the problem try the following:

    1) Make sure your Linux distribution is up to date:

    apt-file update

    2) Now you can write a search to answer "what package provides the gl.h file?"

    apt-file search "gl.h"

    3) The result should be something like mesa-dev or opengl-dev.

    4) Once you know what package provides "gl.h", (let's pretend the result from apt-file is "libmesa-dev"), install it:

    apt-get install libmesa-dev
  • Thanks for the reply, but the command "apt-file update" don't exist!
  • Ok, then just try:

    sudo apt-get update
    sudo apt-get install mesa-common-dev
  • Thanks for the reply, i've installed the package, but the command "apt-file update" is not installed. Ubuntu tells me to install it with "apt-get install apt-file", should I do this?
  • Now the error is the library "Xrandr.h":
  • edited November 2015
    The problem is that some libraries required to compile raylib are missing from your system, but there shouldn't be many more missing libs...

    Just install:

    sudo apt-get install libx11-dev
    sudo apt-get install mesa-common-dev
    sudo apt-get install libxrandr-dev
    sudo apt-get install libxi-dev

    Don't need to install apt-file.
  • Thanks, now it works, but I have other problems.
    After executing the command "make" I get the file "raylib.a", and i copy/paste it into the project folder with "raylib.h". When I compile an example program (the second with the circle that moves according to the arrow keys) the compiler gives me this error:

    P.S. sorry for the language and to waste your time!
  • I have solved with:
    I recommend adding in "" that other libraries are needed and indicate where they are (with Ubuntu: sudo apt install mesa-common-dev-dev libx11 libxrandr libXi-dev-dev cmake xorg-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev

    Cmake needs for compiling GLFW3, the guide is here:

    Now i can use raylib library!
  • If you want i can write the guide in the "" and then make a pull request!
  • edited November 2015
    Hello LelixSuper! Excuse me for the late response!

    You're not wasting my time! I created raylib to be used by people to learn videogames programming; any question to get that objective is welcomed!

    Despite I tried to keep raylib dependencies to the minimum, it depends on a couple of external libraries: GLFW3, GLEW, OpenAL. You need to install those libraries to compile raylib sources (as you did) but you also need to link with those libraries when compiling raylib programs (not only direct dependencies but also dependencies of dependencies):

    gcc -o raylib_game raylib_game.c -O2 -Wall -std=c99 -lraylib -lglfw3 -lGLEW -lGL -lopenal -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -pthread

    And it also depends on the Linux distribution...

    It would be great to have a guide to install it, I can add it to the raylib wiki:

    You can send me the guide and I'll add it!

    By the way, glad to hear that you manage to compile raylib and use it! :D
Sign In or Register to comment.