Compile OpenGL Program (Missing GL/gl.h)

I'd guess you don't have whatever dev package(s) provide gl.h. apt-file is the command line tool to use.

First, make sure it's up to date:

apt-file update

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

apt-file search "gl.h"

I don't have an ubuntu box just now to check, but I'd guess the result will be something like mesa-dev or opengl-dev.

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

More info on the apt family of commands: https://help.ubuntu.com/community/AptGet/Howto


For GL/gl.h use:

sudo apt install mesa-common-dev

You may also find these helpful, for, say, GL/glu.h:

sudo apt install libglu1-mesa-dev freeglut3-dev