# OpenGL build error

**URL:** <https://forum.juce.com/t/opengl-build-error/8654>\
**Category:** Linux\
**Created:** [May 8, 2012, 2:18pm UTC](https://forum.juce.com/t/opengl-build-error/8654 "2012-05-08T14:18:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterv](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peterv/32/151_2.png) [@peterv](https://forum.juce.com/u/peterv)\
**Post date:** [May 8, 2012, 2:18pm UTC](https://forum.juce.com/t/opengl-build-error/8654/1 "2012-05-08T14:18:14Z")

</div>

I get an error building JuceDemo.

```auto
Compiling juce_opengl.cpp
In file included from ../../../../modules/juce_opengl/juce_opengl.cpp:187:0:
../../../../modules/juce_opengl/native/juce_OpenGL_linux.h: In member function ‘void juce::OpenGLContext::NativeContext::initialiseOnRenderThread()’:
../../../../modules/juce_opengl/native/juce_OpenGL_linux.h:109:91: error: invalid conversion from ‘void*’ to ‘GLXContext {aka __GLXcontextRec*}’ [-fpermissive]
/usr/include/GL/glx.h:203:19: error: initializing argument 3 of ‘__GLXcontextRec* glXCreateContext(Display*, XVisualInfo*, GLXContext, int)’ [-fpermissive]
make: *** [build/intermediate/Debug/juce_opengl_1890bee0.o] Error 1
make: *** Waiting for unfinished jobs....
```

This fixes the error

```auto
diff --git a/modules/juce_opengl/native/juce_OpenGL_linux.h b/modules/juce_opengl/native/juce_OpenGL_linux.h
index c46a569..5e0ada7 100644
--- a/modules/juce_opengl/native/juce_OpenGL_linux.h
+++ b/modules/juce_opengl/native/juce_OpenGL_linux.h
@@ -106,7 +106,7 @@ public:
     void initialiseOnRenderThread()
     {
         ScopedXLock xlock;
- renderContext = glXCreateContext (display, bestVisual, contextToShareWith, GL_TRUE);
+ renderContext = glXCreateContext (display, bestVisual, (GLXContext) contextToShareWith, GL_TRUE);
         makeActive();
     }
```

I am using Ubuntu 12.04 64 bit

Peter

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 8, 2012, 2:38pm UTC](https://forum.juce.com/t/opengl-build-error/8654/2 "2012-05-08T14:38:26Z")

</div>

Doh! Thanks!
