Friday, January 28, 2005

Setting up GLUT in VS.NET 2003

In order to use OpenGL's GLUT in Visual Studio .NET 2003, you need to download the GLUT Win32 port from the following webpage http://www.xmission.com/~nate/glut.html

Installing GLUT for VS.NET 2003
1) Download the binaries (http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip) and unzip accordingly

2) Copy "glut.h" to "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include" (assuming your VS.NET 2003 resides in the above folder)

3) Copy "glut32.lib" to "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib"

4) Copy "glut32.dll" to "C:\Windows\System32"

This will take care of the compilation in VS.NET 2003.

Error with exit() in VS.NET 2003
Now, VS.NET 2003 seems to have a problem with using both GLUT and C++ Standard Library. It will complain of the exit() function being redefined. Do this ...

(1) Go to the offending line in stdlib.h (when you double-click on the error message, VS.NET will open stdlib.h and position the ‘erroneous’ code). Change it to the following
#ifndef GLUT_API_VERSION
_CRTIMP __declspec(noreturn) void __cdecl exit(int);
#endif

Add the #ifndef GLUT... and #endif preprocessor into your code and it would compile without a problem.


0 Comments:

Post a Comment

<< Home