Regarding glut.h is not shown in /usr/include/GL


In my LINUX system library regarding OpenGL and Xlib is already installed and header files are included in /usr/include/GL path.Inside that gl.h,glu.h,glx.h… are presented.But glut.h is not presented.I execute a program which includes glut.h and other header files like gl.h,glu.h. It shows error which is displayed below…

Errors while executing openGl progs :

main.cpp:32:21: error: GL/glut.h: No such file or directory
main.cpp:41: error: ‘GLuint’ does not name a type
main.cpp:51: error: ‘GLuint’ does not name a type
main.cpp: In function ‘void initRendering()’:
main.cpp:67: error: ‘GL_DEPTH_TEST’ was not declared in this scope
main.cpp:189: error: ‘glutInitWindowSize’ was not declared in this scope
main.cpp:191: error: ‘glutCreateWindow’ was not declared in this scope
main.cpp:194: error: ‘glutDisplayFunc’ was not declared in this scope
main.cpp:195: error: ‘glutKeyboardFunc’ was not declared in this scope
main.cpp:196: error: ‘glutReshapeFunc’ was not declared in this scope

“So, I downloaded glut3.6 version Library and try to install glut library once again. It successfully executes mkmkfiles.imake, but while giving
make command it shows the following error.”

Errors while installing glut3.6.tar.gz :

gcc -m32 -o test21 -O2 -fno-strength-reduce -fno-strict-aliasing
-L/usr/lib test21.o …/…/lib/glut/libglut.a -lGLU -lGL -lXmu -lXt -lSM
-lICE -lXext -lX11 -lXi -lXext -lX11 -lm
…/…/lib/glut/libglut.a(glut_vidresize.o): In function glutVideoPan': glut_vidresize.c:(.text+0x54): undefined reference toglXChannelRectSyncSGIX’
glut_vidresize.c:(.text+0x8f): undefined reference to glXChannelRectSGIX' ../../lib/glut/libglut.a(glut_vidresize.o): In functionglutVideoResize’:
glut_vidresize.c:(.text+0xd5): undefined reference to
glXChannelRectSyncSGIX' glut_vidresize.c:(.text+0x110): undefined reference toglXChannelRectSGIX’
…/…/lib/glut/libglut.a(glut_vidresize.o): In function glutVideoResizeGet': glut_vidresize.c:(.text+0x256): undefined reference toglXQueryChannelDeltasSGIX’
glut_vidresize.c:(.text+0x2fc): undefined reference to
glXQueryChannelRectSGIX' ../../lib/glut/libglut.a(glut_vidresize.o): In functionglutStopVideoResizing’:
glut_vidresize.c:(.text+0x3a4): undefined reference to
glXBindChannelToWindowSGIX' ../../lib/glut/libglut.a(glut_vidresize.o): In functionglutSetupVideoResizing’:
glut_vidresize.c:(.text+0x3fd): undefined reference to
glXBindChannelToWindowSGIX' collect2: ld returned 1 exit status make[2]: *** [test21] Error 1 make[2]: Leaving directory/home/Karthik/Desktop/glut-3.6/test/glut’
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/Karthik/Desktop/glut-3.6/test’
make: *** [all] Error 2

I request you to give a solution for my problem.Waiting for your valuable reply.


Cleanest way to solve : use your package management system.
Depends on your linux distribution :

  • something like that for debian based (ubuntu, etc) :
    sudo apt-get install freeglut-dev
  • or somthing like that for rpm based (redhat, fedora etc) :
    yum install freeglut-devel

What is your linux distribution and its version ?