# Some missing defines

**URL:** <https://discourse.glfw.org/t/some-missing-defines/295>\
**Category:** support\
**Created:** [December 13, 2010, 1:25am UTC](https://discourse.glfw.org/t/some-missing-defines/295 "2010-12-13T01:25:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [December 13, 2010, 1:25am UTC](https://discourse.glfw.org/t/some-missing-defines/295/1 "2010-12-13T01:25:12Z")

</div>

**anonymous** wrote on [Monday, December 13, 2010](https://sourceforge.net/p/glfw/discussion/247562/thread/e41958fe/#ee3c):

Got compile errors while trying to build glfw: missing the following defines:

GLX\_FRAMEBUFFER\_SRGB\_CAPABLE\_ARB  
GLX\_CONTEXT\_ES2\_PROFILE\_BIT\_EXT

I don’t know where they should be defined (glxext.h, maybe?) so I just added  
them to x11\_window.c

Greetigs

```
diff --git a/src/x11/x11_window.c b/src/x11/x11_window.c
index 0b026b1..bc4f0a0 100644
--- a/src/x11/x11_window.c
+++ b/src/x11/x11_window.c
@@ -35,6 +35,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#ifndef GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB
+ #define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
+#endif
+#ifndef GLX_CONTEXT_ES2_PROFILE_BIT_EXT
+ #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#endif
+
+
 
 // Action for EWMH client messages
 #define _NET_WM_STATE_REMOVE 0
```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [January 1, 2011, 4:37pm UTC](https://discourse.glfw.org/t/some-missing-defines/295/2 "2011-01-01T16:37:47Z")

</div>

**[starseeker](https://sourceforge.net/u/starseeker/)** wrote on [Saturday, January 01, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/e41958fe/#507f):

I also saw the same thing, and a grep of my system GL include directory only  
found them in the glxew.h header.

Rather than just grabbing those two definitions, I decided to see if I could  
just add glew directly to glfw (the glew license doesn’t look to be any  
problem?). This proved (at least on this platform) to be surprisingly  
simple. Here is the patch (I built on X11 only so far, but I imagine the  
changes for the other platforms would be equally minimal):

diff -git a/CMakeLists.txt b/CMakeLists.txt  
index c99d1fc…e36b16d 100644  
– a/CMakeLists.txt  
+++ b/CMakeLists.txt  
@@ -16,6 +16,8 @@ include(CheckSymbolExists)  
find\_package(OpenGL REQUIRED)

set(common\_SOURCES  
+ ${GLFW\_SOURCE\_DIR}/src/glew/glew.c  
+ ${GLFW\_SOURCE\_DIR}/src/glew/visualinfo.c  
${GLFW\_SOURCE\_DIR}/src/enable.c  
${GLFW\_SOURCE\_DIR}/src/error.c  
${GLFW\_SOURCE\_DIR}/src/fullscreen.c  
@@ -28,6 +30,8 @@ set(common\_SOURCES  
${GLFW\_SOURCE\_DIR}/src/window.c  
)

+SET(GLFW\_INCLUDE\_DIR ${CMAKE\_CURRENT\_SOURCE\_DIR}/include)  
+  
#---------------------------------------------  
# Set up GLFW for Win32 and WGL on Windows  
#---------------------------------------------  
diff -git a/src/x11/platform.h b/src/x11/platform.h  
index a243bff…372945a 100644  
– a/src/x11/platform.h  
+++ b/src/x11/platform.h  
@@ -41,6 +41,8 @@  
#include \<X11/keysym.h\>  
#include \<X11/Xatom.h\>

+#include “…/…/include/GL/glxew.h”  
+  
#include \<GL/glx.h\>

#include “…/…/include/GL/glfw3.h”

and added the following files from glew 1.5.7

# new file: include/GL/glew.h  
# new file: include/GL/glxew.h  
# new file: include/GL/wglew.h  
# new file: src/glew/glew.c  
# new file: src/glew/visualinfo.c

I don’t really have a clear idea yet of the scope of glew vs. glfw and whether  
I just committed a cardinal sin, but this appeared to result in every test  
building and running without trouble - from my standpoint it also has one  
other major advantage in that I need a CMake build system and glew doesn’t  
appear to have one of its own. If I’m going to need both glfw and glew to  
achieve the effect of seamless cross platform opengl windows (basically I’m  
looking for the least-impact approach that’ll let me do that without  
maintaining my own code) it’s nice to have all that in one compact drop-in.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [January 1, 2011, 5:17pm UTC](https://discourse.glfw.org/t/some-missing-defines/295/3 "2011-01-01T17:17:39Z")

</div>

**[starseeker](https://sourceforge.net/u/starseeker/)** wrote on [Saturday, January 01, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/e41958fe/#6dac):

Ooops - actually, visualinfo.c should not be a part of the build - it’s just  
glew.c

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [January 3, 2011, 2:42am UTC](https://discourse.glfw.org/t/some-missing-defines/295/4 "2011-01-03T02:42:34Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Monday, January 03, 2011](https://sourceforge.net/p/glfw/discussion/247562/thread/e41958fe/#0b64):

Fixes for this and other issues have been pushed. Sorry about the delay.
