Compiling OpenGL Programs Using Visual Studio on Lab Windows Machines (e.g., MLH 301):

The hardest part about compiling any program using Visual Studio is figuring out how to navigate the myriad of options. Once you figure out what is important for your project and what you should leave as default, everything is easy.

Remember, the key things you need to do are:

The instructions below will get you through the initial step of setting up a project. Even if you have used Visual Studio before for other classes, I encourage you to read all the steps, as some selections will differ from those needed in prior courses.

These instructions work for Visual Studio 2008, though they are mostly similar for other versions:

  1. Open Visual Studio 2008.
  2. Once it has completely opened (which may take some time) select from the menu "File" followed by "New" followed by "Project".
  3. In the New Project dialog box:
  4. In the Win32 Application Wizard dialog box:
  5. You will now return to the main Visual Studio window, where a subwindow entitled "Solution Explorer" will appear. This contains information about "Solution < myTestProject >" (where < myTestProject > is whatever you named your project). Visual Studio should also have created a project directory where it will store the files. Open up the directory "< myTestProject >" and its subdirectory (also called "< myTestProject >"). There you should see a file called < myTestProject >.vcproj (or labeled "VC++ Project"). Copy any code you would like to use into this subdirectory. If there are a lot of files, you may wish to arrange them in an organized fashion.
  6. Back in the Visual Studio subwindow (the "Solution Explorer"), you should see folders labeled "Header Files" and "Source Files."
  7. Right click on the BOLD name of your project in the "Solution Explorer."
  8. Double click on any of the listed code files to open them and begin editing.
  9. Once you have finised coding, press "F7" to compile (or build) your project.
  10. Your executable will be in the "Debug" subdirectory of the project's directory. If your executable requires no command-line parameters, you can run it directly from inside Visual Studio by pressing "F5."

If you change the project from a "Debug" to a "Release" build (which I would not recommend during this class), you may need to repeat your changes to the solution's properties page as the Debug and Release builds (by default) have separate properties.

Please remember to submit your entire project directory (as a single .zip file) when turning in your homework!


Last Modified: Friday, July 22, 2005

Chris Wyman (cwyman@cs.uiowa.edu)