X11/Xlib.h not found in Ubuntu

LinuxOpengl EsCompiler Errors

Linux Problem Overview


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.

Linux Solutions


Solution 1 - Linux

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

Solution 2 - Linux

Presume he's using the tutorial from http://www.arcsynthesis.org/gltut/ along with premake4.3 :-)

> sudo apt-get install libx11-dev ................. for X11/Xlib.h
> sudo apt-get install mesa-common-dev........ for GL/glx.h
> sudo apt-get install libglu1-mesa-dev ..... for GL/glu.h
> sudo apt-get install libxrandr-dev ........... for X11/extensions/Xrandr.h
> sudo apt-get install libxi-dev ................... for X11/extensions/XInput.h

After which I could build glsdk_0.4.4 and examples without further issue.

Solution 3 - Linux

Why not try find /usr/include/X11 -name Xlib.h

If there is a hit, you have Xlib.h

If not install it using sudo apt-get install libx11-dev

and you are good to go :)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDenys S.View Question on Stackoverflow
Solution 1 - LinuxAndrew WhiteView Answer on Stackoverflow
Solution 2 - LinuxBob SmithView Answer on Stackoverflow
Solution 3 - LinuxZohaib AmanzaiView Answer on Stackoverflow