Glut exit error

I am using to compile opengl written in c++
In my program I have included these

#include <GL/glut.h>
#include <stdio.h>

among a couple others
Now when I compile I get an error complaining about exit differs

c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\stdlib.h(256) : error C2381: ‘exit’ : redefinition; __declspec(noreturn) differs
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\gl\glut.h(146) : see declaration of ‘exit’

I read the glut file and there is a bit of imformation about when using muliple CRT’s there can be problems. But I am quite new to opengl and don’t really understand this can anyone help me solve this error? please

Do you by chance declare an exit function? If so, don’t - rename it, change its scope, change its prototype from the standard exit, etc. If not, give more info though I don’t know what info you might give other than posting more code - where you call exit in your prog, etc. I haven’t had any issues with VC7 or VC8

I’ve had this problem as well…it seems that GLUT defines an exit() function of its own, and I’ve had problems whenever I include <gl/glut.h> before <stdlib.h>. The solution that works for me is to make sure that I include <stdlib.h> before Iinclude <gl.glut.h>. Hope that helps!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.