Search code examples
linuxopengl-escompiler-errors

X11/Xlib.h not found in Ubuntu


I'm trying to write a rather trivial program using open gl on linux, but at a compile time it says:

Compile thumb : egl <= cuberenderer.c In file included from /path/include/egl.h:36, from /path/cuberenderer.c:7: /path/include/eglplatform.h:89:22: error: X11/Xlib.h: No such file or directory /path/include/eglplatform.h:90:23: error: X11/Xutil.h: No such file or directory

I'm totally new to GL and have no idea what's wrong.


Solution

  • A quick search using...

    apt search Xlib.h
    

    Turns up the package libx11-dev but you shouldn't need this for pure OpenGL programming. What tutorial are you using?

    You can add Xlib.h to your system by running the following...

    sudo apt install libx11-dev
    

    On Redhat based systems (tested on RHEL9)

    dnf install libX11-devel