View Full Version : The header file:how to include GLUT.h

03-16-2006, 06:15 PM
Something must be added and some settings must be done before you can compile programs with OpenGL functions,someone said.My partner told me: glut32.lib should be added to the folder INCLUDE,and the glut32.dll and glut.dll should be added to the folder Windows/system32,which I have done correctly.At last,Having entered the Visual C++ 6.0,under my project,I changed the project Settings by adding opengl32.lib and glut32.lib to the LINK item.All of the steps have been finished.The glut.h can't be included correctly!Why? Confusing.....

Ehsan Kamrani
03-16-2006, 10:08 PM
You should do the following steps:
1.add glut.h to the folder INCLUDE\GL
2.add glut32.dll to the folder Windows/systems32
3.add glut32.lib to the folder LIB
4.go to the project settings and add glut32.lib
5.#include<glut.h> in your cpp file
6.enjoy the GLUT ;-)


03-17-2006, 02:35 PM
I have done it.Unfortunately,it doesn't work!
What's wrong with it?

Ehsan Kamrani
03-18-2006, 12:17 AM
What errors do you recieve?

03-20-2006, 05:15 AM
I have the same problem. I have done all the steps you said but, even though I get 0 errors 0 warnings in the compile and build stage, when i try to run the program it crashes and the error i get is "Unhandled exception in test.exe(GLUT32.DLL) 0x0000005: Access Violation". Any ideas????

Ehsan Kamrani
03-20-2006, 08:33 AM
As you recieve a run time error, it refers to the dll file. In windows 98 you should copy the file glut32.dll to the folder system . In windows XP you should copy this file in the folder system32.

03-20-2006, 06:11 PM
I copy glut32.dll in the folder system32,for my OS is Windows XP.But it failed to compile.
The error is:
fatal error C1083: Cannot open include file: 'gl\glut.h': No such file or directory

Ehsan Kamrani
03-21-2006, 12:50 AM
compiler can not find the header file. So copy the file glut.h in the folder INCLUDE\GL

03-21-2006, 05:55 PM
I did all of them,but it turned to be useless.
The files gl\gl.h, gl\glu.h and gl\glaux.h can be included successfully except gl\glut.h.
It may be something out of my knowledge.
Thanks for your attention.

Ehsan Kamrani
03-22-2006, 05:34 AM
What compiler do you use?
Can you post your code?

03-22-2006, 05:45 PM
My compiler is Visual C++ 6.0.Is it the bug of the compiler?

Ehsan Kamrani
03-23-2006, 12:19 AM
Can you post your code?
Move to the project settings and in the link tab, add glut32.lib

03-23-2006, 09:30 AM
No, that is not a bug of compiler. Are you sure that glut.h files really reside in place where gl.h and other files are? You can search for that file to make sure it's in place, if not - you know what to do. Or maybe you use some letter from national keyboard set, try to reenter that string again manually (in program): gl/glut.h

03-23-2006, 08:52 PM
I swear that I have done all of the steps:
1.put glut32.lib to folder LIB
2.put glut32.dll to folder system32
3.put glut.h to folder INCLUDE
4.change the link tab in Project settings by adding glut32.lib
5.add #include<gl\glut.h> to my program
My God! Useless!
Help me...

03-24-2006, 03:15 AM
as already told here, put glut.h into <INCLUDEDIR>\gl\

03-25-2006, 06:21 PM
I have done,but it turned out to be useless.So I removed the whole Visual C++ 6.0,and I installed .NET instead of C++.This time after all the steps has been done ,it works well.

Ehsan Kamrani
03-26-2006, 10:55 AM
Congratulations to you :)

03-26-2006, 06:57 PM
Thanks for your help.