关闭

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

2314人阅读 评论(0) 收藏 举报
最近移植一个项目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

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:90390次
    • 积分:1329
    • 等级:
    • 排名:千里之外
    • 原创:43篇
    • 转载:0篇
    • 译文:0篇
    • 评论:17条
    文章分类
    最新评论