The header file:how to include GLUT.h

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…

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 :wink:

-Ehsan-

I have done it.Unfortunately,it doesn’t work!
What’s wrong with it?

What errors do you recieve?

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???

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.
-Ehsan-

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

compiler can not find the header file. So copy the file glut.h in the folder INCLUDE\GL
-Ehsan-

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.

What compiler do you use?
Can you post your code?
-Ehsan-

My compiler is Visual C++ 6.0.Is it the bug of the compiler?

Can you post your code?
Move to the project settings and in the link tab, add glut32.lib
-Ehsan-

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

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…

as already told here, put glut.h into <INCLUDEDIR>\gl\

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.

Congratulations to you :slight_smile:

Thanks for your help.