This instruction is for compiling OpenGL in Visual C++ .

First, make sure you have the following files in your hard disk:

Opengl32.dll and glu32.dll should already be in the \windows\system32 folder. (or \windows\SysWOW64 for 64 bit windows)

Opengl32.lib and glu32.lib should already be in the PlatformSDK\Lib folder for VC++ (or Microsoft SDKs\Windows\v7.0A\Lib)

gl.h and glu.h should be in the PlatformSDK\Include\gl folder for VC++ (or Microsoft SDKs\Windows\v7.0A\Include\gl)

All the above files come with Windows and VC++.

 

Second, you have to get glut32.lib, glut32.dll and glut.h in the package of GLUT 3.6

The files can be found off the web or course FTP.

Put them in the same places as the other files with the same file extensions.

 

Third, follow these steps to test your OpenGL code,

Create a C++ & Win32 console application.

Disable precompiled header file.

At the beginning of your code, add the following lines

#pragma comment (lib,"glu32.lib")

#pragma comment (lib,"glut32.lib")

#pragma comment (lib,"opengl32.lib")

#include <windows.h>

#include <gl/gl.h>

#include <gl/glu.h>

#include <gl/glut.h>

Here you go, try to complete your code and build the .exe file.

Check www.opengl.org for more information.

 

PS. For earlier version of VC++, you should modify project settings by adding Opengl32.lib, glu32.lib and glut32.lib under the link menu.