The Solution for 'redefinition of exit()' in glut.h and stdlib.h
When develop GLUT projects in Windows system, we always encounter this problem or like:
D:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/include/stdlib.h(256) : error C2381: ' exit ' : redefinition ; __declspec(noreturn) differs
D:/programs/glut-3.7.6-bin/GL/glut.h(146) : see declaration of ' exit '
We could simply solve this problem by opening glut.h and find the definition of exit() function (about line 144). Replace them by following. Then rebuild project:
Windows下用到GLUT进行OpenGL开发时,时常会碰到exit()这个函数在stdlib.h与glut.h两个头文件中重复定义的情况,解 决方案如下:
打开glut.h,找到exit()函数定义的地方(144行左右),替换为以下内容:
然后重新编译项目即可。