# Segmentation fault when creating a window

**URL:** <https://discourse.glfw.org/t/segmentation-fault-when-creating-a-window/709>\
**Category:** support\
**Created:** [July 15, 2016, 4:07pm UTC](https://discourse.glfw.org/t/segmentation-fault-when-creating-a-window/709 "2016-07-15T16:07:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mateo](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@mateo](https://discourse.glfw.org/u/mateo)\
**Post date:** [July 15, 2016, 4:07pm UTC](https://discourse.glfw.org/t/segmentation-fault-when-creating-a-window/709/1 "2016-07-15T16:07:03Z")

</div>

Hi there,  
I’m new to GLFW, and I’m having problems getting started.  
I want to create an OpenGL ES application for desktop (yes, ES). I’m using 64-bit linux. I have a standard installation of GLFW 3.2. When I try to create a window using this code:

```
#define GLFW_INCLUDE_ES3
#include <GLFW/glfw3.h>
GLFWwindow* createWindow(uint16_t width, uint16_t height, const char* title)
{
    bool init = glfwInit();
    if (!init)
    {
            return NULL;
    }
    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
    return glfwCreateWindow(width, height, title, NULL, NULL);
}

```

I get the following output:

```
GL renderer: [NVS 300/PCIe/SSE2]
GL vendor:[NVIDIA Corporation]
GL version: [3.3.0 NVIDIA 340.96]
GL shading language version: [3.30 NVIDIA via Cg compiler]
Segmentation fault (core dumped)

```

I think the problem is that I’m using NVidia driver 340.96, which does not support OpenGL ES. However, I have an OpenGL ES emulator - my own [libGLESv2.so](http://libGLESv2.so), [libEGL.so](http://libEGL.so), etc. Is there a way to make GLFW link/include these libraries (which as far as I can tell are the system default anyway)?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![tombsar](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tombsar](https://discourse.glfw.org/u/tombsar)\
**Post date:** [July 16, 2016, 12:19pm UTC](https://discourse.glfw.org/t/segmentation-fault-when-creating-a-window/709/2 "2016-07-16T12:19:15Z")

</div>

Are you able to step through with a debugger to determine in which function+line the segfault occurs?

---

<div class="post-metadata">

**Author:** ![mateo](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@mateo](https://discourse.glfw.org/u/mateo)\
**Post date:** [July 18, 2016, 7:56am UTC](https://discourse.glfw.org/t/segmentation-fault-when-creating-a-window/709/3 "2016-07-18T07:56:38Z")

</div>

This is the output I get from gdb:

```
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) backtrace 
#0 0x0000000000000000 in ?? ()
#1 0x0000000000408260 in parseVersionString (api=0x6ef8d0, major=0x6ef8d8, minor=0x6ef8dc, rev=0x6ef8e0)
    at /home/<USER>/Downloads/glfw-3.2/src/context.c:56
#2 0x0000000000408b69 in _glfwRefreshContextAttribs (ctxconfig=0x7fffffffdc00) at /home/<USER>/Downloads/glfw- 3.2/src/context.c:384
#3 0x000000000040d30a in glfwCreateWindow (width=640, height=480, title=0x41c9ef "Shader visualizer", monitor=0x0, share=0x0)
    at /home/<USER>/Downloads/glfw-3.2/src/window.c:207
#4 0x000000000040798e in createWindow (width=640, height=480, title=0x41c9ef "Shader visualizer")
    at <DIRECTORY>/Native.c:34
#5 0x00000000004079c8 in showVisualizer (environment=0x0, object=0x0)
    at <DIRECTORY>/Native.c:40
#6 0x0000000000407a92 in main () at <DIRECTORY>/Native.c:67
(gdb) frame 1
#1 0x0000000000408260 in parseVersionString (api=0x6ef8d0, major=0x6ef8d8, minor=0x6ef8dc, rev=0x6ef8e0)
    at /home/<USER>/Downloads/glfw-3.2/src/context.c:56
56 version = (const char*) window->context.GetString(GL_VERSION);

```

At this point, gdb says GL\_VERSION and context have no symbol in the current context

---

<div class="post-metadata">

**Author:** ![elmindreda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/elmindreda/32/26_2.png) [@elmindreda](https://discourse.glfw.org/u/elmindreda)\
**Post date:** [July 18, 2016, 11:49am UTC](https://discourse.glfw.org/t/segmentation-fault-when-creating-a-window/709/4 "2016-07-18T11:49:34Z")

</div>

Try it without setting `GLFW_CONTEXT_CREATION_API`.
