Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
来源:互联网 发布:智能开关 app 源码 编辑:程序博客网 时间:2024/06/06 08:56
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 .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 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
然后重新编译项目即可。
0 0
- Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
- Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
- glut.h 与 stdlib.h 的exit冲突问题的解决
- glut.h头文件总是和C++中定义的exit冲突
- stdlib.h包含的函数
- stdlib.h头文件下的常用函数
- C语言中stdlib.h下的malloc函数的全称
- stdlib.h中system函数一定需要注意的地方
- c++中头文件stdlib.h主要包含的函数
- C++中,头文件stdlib.h主要包含的函数
- stdio.h与stdlib.h
- 通用函数stdlib.h
- <stdlib.h>包括的函数讲解 (
- 2014/9/30------C语言 常用的 windows.h 与 stdlib.h
- 使用malloc函数时,#include<malloc.h>与#include<stdlib.h>的区别
- 转:C语言头文件下包含函数(math.h stdio.h stdlib.h string.h)
- <stdlib.h>函数请单
- vc2012\vc\include\stdlib.h(360): error C2381: “exit”: 重定义;__declspec(noreturn) 不同
- [Java] this与super的区别
- linux高级编程基础系列:线程间通信
- 简单的异或加密解密算法
- appium+testng报告更改
- 二叉搜索树的基本java实现
- Windows下stdlib.h与glut.h中exit()函数重复定义的解决方案
- Android中异步消息处理机制
- 重载 CreateParams 方法[1]: 从一个例子开始(取消窗口最大化、最小化按钮的三种方法)
- 个人初做小游戏RunRunMagic(五) 总结
- 在线编程--栈的压入、弹出序列
- WPF 中 的多线程
- 欢迎使用CSDN-markdown编辑器
- Android Handle,Looper,Message消息机制
- HM编码器代码阅读(14)——帧间预测之AMVP模式(二)predInterSearch函数