遮天 有声:Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 00:17:31
The Solution for 'redefinition of exit()'in glut.h and stdlib.h
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:
- #if defined(_WIN32)
- # ifndef GLUT_BUILDING_LIB
- #if _MSC_VER >= 1200
- _CRTIMP __declspec(noreturn) void __cdecl exit(int);
- #else
- _CRTIMP void __cdecl exit(int);
- #endif
- # endif
- #else
Windows下用到GLUT进行OpenGL开发时,时常会碰到exit()这个函数在stdlib.h与glut.h两个头文件中重复定义的情况,解决方案如下:
打开glut.h,找到exit()函数定义的地方(144行左右),替换为以下内容:
view plaincopy to clipboardprint?
- #if defined(_WIN32)
- # ifndef GLUT_BUILDING_LIB
- #if _MSC_VER >= 1200
- _CRTIMP __declspec(noreturn) void __cdecl exit(int);
- #else
- _CRTIMP void __cdecl exit(int);
- #endif
- # endif
- #else
然后重新编译项目即可。
Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
stdlib.h这个头文件
补习C语言之在.h文件中定义全局变量
exit()函数详解和Exit() 和 Return() 的差别
WINDOWS下的低级音频函数介绍
生活中喝茶的误区h
难得一见的玉中极品h
好听的轻音乐【不断更新中.......】h
vb中format函数定义
H.264视频编码器的研究与
老子与孔子的临别赠言h
安格尔与他的油画作品 - h
容貌与身材的绝配h
情夫与丈夫h
胆与养生 h
与人沟通中,怎样成为说话高手h
Windows XP快捷键大全(中文版)H
Qt在Windows下的入口点函数
胃火、肝火、心火、肺火 的下火方案h
摄影师镜头下的绝美华夏h
低值易耗品跟管理费用下的低值易耗品有什么区别?h
人生哲理:微笑是生活中最美丽的画卷h
H.264 中很有用的一些概念(转)
熬夜的危害 h