• Articles
  • Installing and Configuring Visual C++ an
Published by
Sep 12, 2014

Installing and Configuring Visual C++ and GLUT

Score: 3.8/5 (140 votes)
*****

Getting OpenGL to Work With Visual C++ 2010

Follow each step, unless you have already done one of these steps.

Install Visual C++ 2010 Express Edition

This is a free C++ IDE from Microsoft that is an excellent tool to start with, if you are interested in programming on a Windows environment.

You can find Visual C++ 2010 on the Visual Studio Express download page on Microsoft's site. It only works on Windows XP and up.

If the Directory C:\Program Files\Microsoft SDKs\Windows\v7.0A exists, go to the next step, otherwise you need to install the Windows SDK for Windows Server 2008 and .NET Framework 3.5

This is the equivalent to the Windowsï Server 2003 SP1 Platform SDK that Visual C++ 2005 users installed. It contains the main OpenGL libraries. You can download the Windows SDK for Windows Server 2008 and .NET Framework from the Microsoft website.

The installation will take a little while.

Install the GLUT Libraries

These are additional libraries that come in handy down the road. Some code samples you find may use them, so I find it best to just have them around right off the bat. I downloaded the original GLUT from Nate Robins' site.

After downloading, unzip them and do the following:

1. Copy the glut.h file into the C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\GL folder.

2. Copy the glut32.lib file into the C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib folder.

3. Copy the glut32.dll files into the C:\Windows\system32 folder.

Create Your First Project

Create a project in Visual C++ with File -> New -> Project, choose a folder and a name for the project and set the template as Win32 Project. Click OK.

Click Next on the following screen and you will be taken to Application Settings. Check Console Application and on Empty Project and then click OK. Your new project has been created.

Declare the dependencies for your project.

1. Click on Project -> [project name] Properties.

2. Expand Configuration Properties.

3. In the Configuration dropdown, select All Configurations.

4. Select Linker -> Input.

5. In the Additional Dependencies field, enter in glu32.Lib OpenGL32.Lib glut32.lib. Then click OK.

Create Your First Source File

Go to File -> New -> File Choose Visual C++ and then C++ file. Enter your code in the source file, remember to add the line:



#include "GL/glut.h"

At the beginning of your file to include the GLUT header file.

After you finished creating the file, Press F7 (or go to Debug -> Build Solution) to compile it and F5 (Debug -> Start Debugging) to run it.

It should be working at this point.