CS 480
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:

  1. Launch Visual C++ Express if it is not already running. Close the Start Page (if it comes up) and any active projects before continuing.

  2. 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:


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

  4. 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:


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

  6. 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 following image:


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

  8. To run a program, chooose "Debug | Start Without Debugging" from the main menu, or press [Ctrl]-[F5] on the keyboard.

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