Search code examples
c++linuxopenglglfwglew

glfw not working in sublime text in linux


when i run the code it says

Segmentation fault (core dumped)
[Finished in 1.5s with exit code 139]

i do not know what to do but i remove it runs well without crashing

unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER,6* sizeof(float), posotions, GL_STATIC_DRAW);

code1

code2


Solution

  • You didn't initialize GLEW. It can be done with glewInit();

    GLEW is the library that gives you those OpenGL functions.