Coder Perfect

X11/Xlib.h not found in Ubuntu

Problem

I’m trying to develop a simple program in OpenGL on Linux, but it complains at compilation time:

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

Asked by Denys S.

Solution #1

A fast lookup with…

apt search Xlib.h

This brings up the libx11-dev package, however this isn’t required for pure OpenGL programming. What’s the name of the instructional you’re using?

By running the following commands, you can add Xlib.h to your system…

sudo apt install libx11-dev

Answered by Andrew White

Solution #2

I’m guessing he’s using premake4.3 and the instruction from http://www.arcsynthesis.org/gltut/:-)

After that, I was able to construct glsdk 0.4.4 and examples without any problems.

Answered by Bob Smith

Solution #3

Why not try looking for Xlib.h in /usr/include/X11?

You have Xlib.h if there is a hit.

If not, use sudo apt-get install libx11-dev to install it.

and you’re all set to go:)

Answered by Zohaib Amanzai

Post is based on https://stackoverflow.com/questions/5299989/x11-xlib-h-not-found-in-ubuntu