[Gllug] Makefile for OpenGL / GLUT

Ian Scott mriscott at yahoo.co.uk
Fri Jul 18 11:39:54 UTC 2008


> Hi,
> 
> I've been trying to compile some OpenGL exercises in Linux, but the
> Makefile code offered by the book doesn't quite work:
> 
> 
> INCPATH =3D -I/usr/X11R6/include/
> LIBS =3D -lglut -lGLU -lGL -lm -lpthread
> LIBPATH =3D -L/usr/lib /usr/X11R6/lib/
> %:%.c
> gcc $(INCPATH) $(LIBPATH) $^ $(LIBS) -o $@
> %:%.cpp
> g++ $(INCPATH) %(LIBPATH) $^ $(LIBS) -o $@
> 
> 
> But when I type a full compilation command:
> 
> g++ -o Example Example.cpp -I /usr/X11R6/include/ -L /usr/X11R6/lib/
> -lglut -lGL -lGLU -lX11 -lXmu -lXi -lm
> 
> That works fine.
> 


It would help if you told us what error you get :-)

The common mistake with makefiles is to mess up the whitespace.  Have you got
real tabs at the start of the command lines (gcc: and g++: lines)?

Ian
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list