Posts tagged “OpenGL

‘exit’ redefinition error in OpenGL

An opengl error that shows up mostly in VS 2003 and VS 2005:

    microsoft visual studio 8\vc\include\stdlib.h(433) : error C2381: 'exit' : 
    redefinition; __declspec(noreturn) differs \includes\gl\glut.h(146) : 
    see declaration of 'exit'

This error is caused by including glut.h before stdlib.h. So just by reversing the order of inclusion we can remove this error:

     #include <GL/glut.h>
     #include <stdlib.h>
to
     #include <stdlib.h>
     #include <GL/glut.h>