Writing OpenGL programs in Linux

I realize this is going to be terrible vague, but I really dont understand the inner workings of various linux distributions to give more details…

I have ubuntu on my laptop, and when I wrote programs in opengl using a makefile that looked like this:

CC = g++

LDLIBS = -lglut -lGL -lGLU -lX11 -lm -L/usr/lib

$(CC) $@.cpp $(LDLIBS) -o $@

However, when using a makefile like this on my desktop, which is running fedora, and trying to compile a program containing the header


I get this compiler error:

blah.cpp:2:21: error: GL/glut.h: No such file or directory

Does this mean I need to manually download and install the source? Or will the headers be located elsewhere? I’ve poked around for a bit and haven’t really found anything that looks like glut.h in the include and lib directories, but then I really dont know where I should be looking. Any help would be GREATLY appreciated.


Looks like you should install glut…

I don’t know if ubuntu has a package system, if so, just search for glut or freeglut. Otherwise, just download freeglut, compile and install it manually, and all should be just fine

you can download source code .
or use apt

You certainly need the development package which contain the headers. Installing the freeglut development package with the following command :

$ sudo apt-get install freeglut3-dev

should be enough.