glut.h头文件总是和C++中定义的exit冲突

最近移植一个项目sensable的3D设备www.sensable.com, glut.h头文件总是和C++中定义的exit冲突,呵呵网上有人弄了,管用。

redefined exit() glut.h and stdlib.h
-------------------------------------------------------------------------------------------s
http://gallery.chiusir.net/imagine/viewtopic.php?t=345&sid=ab5fbe04a5ee666f34a70579c4c2e89b

GLUT - MS VC++ .NET 2003 header file changes
I was compiling this GLUT-based application by name GLUI, available at http://www.cs.unc.edu/~rademach/glui.

Got some strange compilation errors...



glui_translation.cpp
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'





It seems like the header file GL/glut.h ought to be changed as follows.


#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


Courtesy: thread


Apparently from the symbol guards, it seems like the prototype has
changed in VC++ 7.0 + compilers ..


# posted by Karthik Kumar : 1:35 PM
Comments:
sweet! thanks!
# posted by Anonymous : 1:30 AM
Post a Comment




/* CKC Mar2005, Ref to http://akktech.blogspot.com/2004/10/glut-ms-vc-net-2003-header-file.html
#if defined(_WIN32)
# ifndef GLUT_BUILDING_LIB
extern _CRTIMP void __cdecl exit(int);
# endif
#else
*/

CKC Mar2005, Ref to http://akktech.blogspot.com/2004/10/glut-ms-vc-net-2003-header-file.html
#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
//
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值