GLUT退出重新定义错误 [英] GLUT exit redefinition error

查看:95
本文介绍了GLUT退出重新定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的简单OpenGL程序中,我收到有关退出重新定义的以下错误:

In my simple OpenGL program I get the following error about exit redefinition:

1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1>        c:\program files\microsoft visual studio 8\vc\platformsdk\include\gl\glut.h(146) : see declaration of 'exit'

我正在使用Nate Robins的 GLUT for Win32 ,并收到此错误Visual Studio 2005或Visual C ++ 2005(Express Edition).此错误的原因是什么,我该如何解决?

I'm using Nate Robins' GLUT for Win32 and get this error with Visual Studio 2005 or Visual C++ 2005 (Express Edition). What is the cause of this error and how do I fix it?

推荐答案

原因:

最新版本的Visual Studio附带的 stdlib.h exit()函数具有不同的定义(并且有冲突).它与 glut.h 中的定义冲突.

The stdlib.h which ships with the recent versions of Visual Studio has a different (and conflicting) definition of the exit() function. It clashes with the definition in glut.h.

解决方案:

用stdlib.h中的glut.h中的定义覆盖.将stdlib.h行放在代码中glut.h行上方.

Override the definition in glut.h with that in stdlib.h. Place the stdlib.h line above the glut.h line in your code.

#include <stdlib.h>
#include <GL/glut.h>

这篇关于GLUT退出重新定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆