<p>In my simple OpenGL program I get the following error about exit redefinition:</p>

<pre><code>1&gt;c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1&gt;        c:\program files\microsoft visual studio 8\vc\platformsdk\include\gl\glut.h(146) : see declaration of 'exit'
</code></pre>

<p>I'm using Nate Robins' <a href="http://www.xmission.com/~nate/glut.html" rel="noreferrer">GLUT for Win32</a> and get this error with Visual Studio 2005 or Visual C++ 2005 (Express Edition). What is the cause of this error and how do I fix it?</p>

Cause:
The
stdlib.h
which ships with the recent versions of Visual Studio has a different (and conflicting) definition of the
exit()
function. It clashes with the definition in
glut.h
.
Solution:
Override the definition in glut.h with that in stdlib.h. Place the stdlib.h line above the glut.h line in your code.
```
```
#include <stdlib.h>
#include <GL/glut.h>
```
```