PDA

View Full Version : glut exit error



eggle
04-24-2005, 05:12 PM
Hi,
I am using visualstudio.net 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
thanks

shinpaughp
04-26-2005, 03:35 PM
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

Kyle Haughey
05-17-2005, 09:04 AM
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!