Instructions for Setting Up OpenGL Projects in Visual C++ 9.0 Express
These instructions assume that you have installed
Microsoft Visual C++ 9.0 Express on your computer. If you have not done this,
Click here and choose "Download Now" to obtain a free copy of this C++ development system.
Follow these steps whenever you wish to create an OpenGL project in the
using Visual C++ Express:
- Launch Visual C++ Express if it is not already running. Close the Start Page (if it comes
up) and any active projects before continuing.
- Choose "File | New | Project" from the menu bar. In the "Project types" panel, choose the "Win32"
option in the Visual C++ tree, in the "templates" panel, choose the "Win32 Console Application"
option in the Visual Studio installed templates section, be sure that the proper folder path is selected in the "Location"
field, and enter the name of your OpenGL project in the "Name" field. Then click
the OK button. See the following image:
- The Overview page of the Win32 Application Wizard will appear on screen — press the "Next" button to move to
the next part of the Wizard. IMPORTANT: don't click the Finish button
at this point, or your programming will be much more difficult than it needs to be.
- Now the Application Settings page of the Win32 Application Wizard will appear on screen.
The "Console Application" item should be selected in the Application type section; if it
isn't, be sure to choose that item. Here's the important part — you must uncheck
the "Precompiled header" item in the Additional options section. Then click the
"Finish" button. See the following image:
- The default starting C++ program that Visual C++ Express sets up for a new project won't
work with OpenGL. Delete the entire contents of the .cpp file that has the same name
as your project. Then paste in the starting program shell found by clicking THIS LINK. You can
then customize this starter code for your application.
- You must add three .lib files to the project so that OpenGL and GLUT functions can be used.
To do this, choose "Project | Add Existing Item" from the main menu bar, browse to the
location where you have stored the Opengl32.lib, glu32.lib, and glut32.lib files, and
add these three files to the project. See the following image:
If you get a weird dialog box on screen that says something about a "custom build rule", just
check the box that says "Don't show this again", and click the "No" button. See the
- Your program can be compiled and linked now, but to run it, the file named "glut32.dll" must be
in the project folder for the current CodeWarrior project. Use Windows Explorer to copy this
file into the folder for this project (the "glut32.dll" file can be found in the LABX1 folder of
the CS480 folder of the instructor's HANDOUT folder on the shared (M:) drive).
Note: if you have CodeWarrior on your own machine, you can copy the glut32.dll file to
a folder in your system's execution path (such as C:\WINDOWS\SYSTEM32), so you won't need to copy
it into every new project folder that you use.
- To run a program, chooose "Debug | Start Without Debugging" from the main menu, or press [Ctrl]-[F5] on the
- To open an already-existing Visual C++ 9.0 Express project, choose "File | Open | Project/Solution" from the
main menu, browse to the location of your project, and open the .sln file.