【发布时间】:2013-11-16 21:17:01
【问题描述】:
我使用的是 mac os 10.9,我有一个使用 freeglut 库的 C++ 程序。当我尝试制作这个项目时。它给出了一个错误,我不知道这是否是我的错。这是消息:
In file included from /usr/X11/include/GL/freeglut.h:18:
/usr/X11/include/GL/freeglut_ext.h:177:27: error: functions that differ only in their return type cannot be overloaded
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
更多信息:我使用 cmake(版本 2.8.12)生成 Makefile,安装了最新版本的 Xcode 和 XQuartz。
任何帮助表示赞赏。谢谢。
在 glut.h 和 freeglut_ext.h 文件中:
在 glut.h 中:
#if (GLUT_API_VERSION >= 5)
extern void * APIENTRY glutGetProcAddress(const char *procName) OPENGL_DEPRECATED(10_3, 10_9);
#endif
在 freeglut_ext.h 中:
/*
* Extension functions, see freeglut_ext.c
*/
typedef void (*GLUTproc)();
FGAPI GLUTproc FGAPIENTRY glutGetProcAddress( const char *procName );
【问题讨论】:
-
你最后是怎么解决的?
-
当代码在一个地方包含
freeglut.h而在另一个地方包含glut.h时,这是一个常见的错误 -
我通过注释掉 freeglut_ext.h 中的冲突声明解决了这个问题