[vlc-commits] nvdec: Avoid including glext.h if glew.h has been included

Martin Storsjö git at videolan.org
Mon Sep 23 11:10:43 CEST 2019


vlc | branch: master | Martin Storsjö <martin at martin.st> | Mon Sep 23 10:56:56 2019 +0300| [7971082e34125a46b4f91f0eac82033d1ac875fc] | committer: Martin Storsjö

nvdec: Avoid including glext.h if glew.h has been included

glew.h and glext.h conflict due to two legacy and unfinished
extensions with conflicting declarations of the same function
name but with differing types (where one clearly is wrong and
never can have been used in that form).

See https://github.com/nigels-com/glew/pull/239 for upstream
discussion on how to fix this in glew and/or the OpenGL
extension registry.

This fixes build errors like these:
glext.h:12230:25: error: typedef redefinition with different types ('void (*)(GLenum, GLenum, GLint *)' (aka 'void (*)(unsigned int, unsigned int, int *)') vs 'void (*)(GLenum, GLenum, const GLint *)' (aka 'void (*)(unsigned int, unsigned int, const int *)'))
typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
                        ^
glew.h:18744:28: note: previous definition is here
typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data);

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7971082e34125a46b4f91f0eac82033d1ac875fc
---

 modules/hw/nvdec/nvdec_gl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/hw/nvdec/nvdec_gl.c b/modules/hw/nvdec/nvdec_gl.c
index 6ebf845597..0259ea2bb0 100644
--- a/modules/hw/nvdec/nvdec_gl.c
+++ b/modules/hw/nvdec/nvdec_gl.c
@@ -35,7 +35,11 @@
 #include "nvdec_fmt.h"
 
 #include "../../video_output/opengl/internal.h"
-#include <GL/glext.h>
+
+// glew.h conflicts with glext.h, but also makes glext.h unnecessary.
+#ifndef __GLEW_H__
+#  include <GL/glext.h>
+#endif
 
 static int Open(vlc_object_t *);
 static void Close(vlc_object_t *);



More information about the vlc-commits mailing list