When develop GLUT projects in Windows system, wealways encounter this problem or like:
D:\Program Files\Microsoft VisualStudio .NET2003\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 byopening glut.h and find the definition of exit() function (about line144). Replace them by following. Then rebuild project:
Windows下用到GLUT进行OpenGL开发时,时常会碰到exit()这个函数在stdlib.h与glut.h两个头文件中重复定义的情况,解决方案如下:
打开glut.h,找到exit()函数定义的地方(144行左右),替换为以下内容:
然后重新编译项目即可。
联系客服