Creating Visual Studio 2008 C & C++ OpenGL/GLUT Projects
- 1. Open Visual Studio 2008
- Start: Programs: Programming and IDEs: Microsoft Visual Studio 2008: Microsoft Visual Studio 2008

- 2. Create a new Visual Studio project
- Visual Studio: File: New: Project

- In the New Project Window
- Project types: Visual C++: Win32
- Templates: Visual Studio installed templates: Win32 Console Application
- Name: [Project Name]
- Location: Click Browse… and navigate to the location where you want to save your project
- Solution Name: Will be the same as your project name unless you specify otherwise
- Check the Create directory for solution checkbox. This will keep things neat or you may create your own folder when you chose your location
- Click OK


- Check the Additional options: Empty project checkbox then click Finish

- An empty project has been created in the location you specified
- The folders within the project are visible in the Solution Explorer in the left column

- 3. You may now either:
- add existing files to the project
- Right-click a folder: Add: Existing Item…
- In the Add Existing Item window
- Browse to the location of the file: Choose the file: Add

- Create a new file in the project
- Right-click a folder: Add: New Item…
- In the Add New Item window
- Categories: Visual C++: Code
- Templates: either C++ File(.cpp) or Header File(.h)
- Name: Enter the a name for the file
- Click Add
![Categories: Code; Templates: either C++ File(.cpp) or Header File(.h); Name: [filename]; Click Add Categories: Code; Templates: either C++ File(.cpp) or Header File(.h); Name: [filename]; Click Add](Images/VS10.PNG)
- An existing file is added to, or an empty file is created in, the project
- 4. Begin Programming
- Click a file in the Solution Explorer and edit it in the right column of the project window

- You must have glut installed to use OpenGL’s glut libraries or the program will not compile
- Your glut include statement depends on how you installed glut. Assuming glut32.dll is in C:\WINDOWS\system32\ do one of the following:
- #include <GL/glut.h> or #include <GL\glut.h> (either will work with Visual Studio) if
- glut32.lib is in C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib and
- glut.h is in C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl
or if
- glut32.lib is in C:\Program Files\Microsoft Visual Studio 9.0\VC\include and
- glut.h is in C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\GL
- #include <glut.h> if
- glut32.lib is in C:\Program Files\Microsoft Visual Studio 9.0\VC\include and
- glut.h is in C:\Program Files\Microsoft Visual Studio 9.0\VC\lib

- 5. Adding Additional Dependencies
- You may also need to tell Visual Studio about the additional dependencies for your project
- Right-click on the top-level project folder: Properties

- Add opengl32.lib glut32.lib glu32.lib to Configuration Properties: Linker: Input: Additional Dependencies field

- 6. Input Resource Files
- Place input resource files needed by your project, or a folder containing them, in the same folder as the project executable ([ProjectName].exe). Double-click on the project executable to run the program

Download these instructions in
Word format
|
PDF format
References
umn