Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
2010-04-28 11:41
344 查看
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行左右),替换为以下内容:
然后重新编译项目即可。
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:
#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行左右),替换为以下内容:
#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
然后重新编译项目即可。
相关文章推荐
- undefined reference to glut*WithExit之类的函数问题的原因及解决
- PHP中被调用的PHP文件中有函数则调用文件里不能重复定义的问题
- 警告: 隐式声明与内建函数 ‘exit’ 不兼容--- 解决方案
- Window关机函数ExitWindowsEx详解
- extern用法,全局变量,全局函数与头文件(重复定义)
- 警告:隐式声明与内建函数'exit'不兼容解决方案
- 解决PHP中函数重复定义的问题
- ExitWindowsEx 函数
- 警告:隐式声明与内建函数'exit'不兼容解决方案
- 【ZZ】windows+python2.7在IDLE中执行sys.exit()出现的问题及解决方案
- Windows下,QT使用MinGW与VS库重定义冲突的解决方案
- PHP避免重复申明函数的解决方案
- 警告: 隐式声明与内建函数 ‘exit’ 不兼容 解决方案
- 警告:隐式声明与内建函数'exit'不兼容解决方案
- 关机,注销,重启函数:ExitWindowsEx
- 定义一个函数清除该数组的重复元素
- C++成员函数实现在类定义中与在类定义外的区别(Windows下直接使用g++)
- 警告: 隐式声明与内建函数 ‘exit’ 不兼容 解决方案
- 头文件里面实现一个函数,在两个cpp中包含,则重复定义,如果加上inline则不会报错
- 头文件中写类的实现出现函数重复定义的问题