Using GLUT with Visual Studio .NET
File Locations for OpenGL with Visual Studio .Net
- To compile programs you do not need to download the full GLUT source, only
the header and binaries: glut-3.7.6-bin.zip.
(If your system does not already have OpenGL download the self extracting
executable Opengl95.exe
from Microsoft and put the files in the corresponding locations.)
- After downloading the zip file, extract the glut files to the following
directories. (If you have Visual Studio installed in another location,
you will have to make the appropriate changes).
 GL.H GLAUX.H GLU.H |
 |
 |
C:\Program Files\Microsoft Visual Studio
.NET\Vc7\include\gl |
|
|
|
|
 GLAUX.LIB GLU32.LIB OPENGL32.LIB |
 |
 |
C:\Program Files\Microsoft Visual Studio
.NET\Vc7\lib |
|
|
|
|
 OPENGL32.DLL GLU32.DLL |
 |
 |
C:\Windows\System |
Creating a Project in .NET:
- New Project (Select Visual C++ Projects, Win32 Project )
- In the Application Wizard select "Application Settings"
from the menu on the left
- Then Choose "Console application "
- And check the "Empty project " box.
- Once the necessary files are in your project, you should be able to
compile and run your GLUT programs. Do not forget to include the GLUT
header in your source:
#include <GL/glut.h>
Errors
If you receive an error about a redefinition of the exit prototype,
there are two possible solutions:
- Replace the exit template in glut.h with the one in stdlib.h so that they
match. This is probably the best solution, and has been used in this glut.h file.
- An easier solution is to #define GLUT_DISABLE_ATEXIT_HACK before you
#include <gl/glut.h> in your program.
If you receive an error about missing precompiled headers do the
following:
- In the Solution Explorer pane right click on the Project and select
Properties.
- Project Properties:
Under C/C++, select Precompiled
Headers
- Next to "Create/Use Precompiled Headers" choose "Not Using Precompiled
Headers"
Running a GLUT Program
To run a GLUT program on another PC, you will need the GLUT32 DLL. You
may put it in the same directory as the executable, or in the C:\Windows\System
directory. This assumes that the other PC already has OpenGL libraries,
which most Win32 machines come with.