Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The GLUT port on Nate Robin's site is from 2001 and has some incompatibilities with versions of Visual Studio more recent than that (.NET 2003 and up). The incompatibility manifests itself as errors about redefinition of <code>exit()</code>. If you see this error, there are two possible solutions:</p> <ol> <li>Replace the <code>exit()</code> prototype in <code>glut.h</code> with the one in your <code>stdlib.h</code> so that they match. This is probably the best solution.</li> <li>An easier solution is to <code>#define GLUT_DISABLE_ATEXIT_HACK</code> before you <code>#include &lt;gl/glut.h&gt;</code> in your program.</li> </ol> <p>(Due credit: I originally saw this advice on the <a href="http://helpdesk.cs.tamu.edu/docs/glut_Visual_Studio2003" rel="noreferrer">TAMU help desk website</a>.)</p> <p>I've been using approach #1 myself since .NET 2003 came out, and have used the same modified <code>glut.h</code> with VC++ 2003, VC++ 2005 and VC++ 2008.</p> <p>Here's the diff for the glut.h I use which does #1 (but in appropriate <code>#ifdef blocks</code> so that it still works with older versions of Visual Studio):</p> <pre><code>--- c:\naterobbins\glut.h 2000-12-13 00:22:52.000000000 +0900 +++ c:\updated\glut.h 2006-05-23 11:06:10.000000000 +0900 @@ -143,7 +143,12 @@ #if defined(_WIN32) # ifndef GLUT_BUILDING_LIB -extern _CRTIMP void __cdecl exit(int); +/* extern _CRTIMP void __cdecl exit(int); /* Changed for .NET */ +# if _MSC_VER &gt;= 1200 +extern _CRTIMP __declspec(noreturn) void __cdecl exit(int); +# else +extern _CRTIMP void __cdecl exit(int); +# endif # endif #else /* non-Win32 case. */ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload