Help request regarding an Open GL error

Hi, I tried to seek help because of a problem that I have with a certain code, basically, I followed a tutorial ( - YouTube ) and did exactly what was instructed in it to setup everything needed for the next parts, unfortunately, I am running into this error when attempting to run the code :


Failed to deactivate shared context before sharing: Descripteur non valide

Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 1.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; co
re = false ; debug = false ; sRGB = false
Created: version = 0.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core
 = false ; debug = false ; sRGB = false
Failed to activate the window's context
Failed to activate the window's context

Process returned -1073741819 (0xC0000005)   execution time : 2.638 s
Press any key to continue.

I am running into the error when running this code :


#include <iostream>
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "It Works!");

    //Irrelevent stuff to test if opengl stuff compiles
    glewInit();
    GLuint test;
    glGenVertexArrays(1, &test);

    //Test if SFML works and compiles
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    glm::mat4 mat = glm::translate(mat, {1,1,1,});  //Test if GLM compiles

    return 0;
}

Can someone help me please ^_^?

Created: version = 0.0

It seems SFML could not create a window with any OpenGL contexts.
Try with another windowing tools (like glfw or glut) and sees if things changed. You could also check on an SFML forum.

There’s also some missing relevant information: which OS, which version of SFML, which compiler, how this was compiled, …

i’d also recommend using glfw + glew instead: