Window creation failed after calling glfwWindowHint to set the opengl profile to the core profile [duplicate]

Solution 1:

GLFW_VERSION_MAJOR & GLFW_VERSION_MINOR are not valid arguments to glfwWindowHint:

glfwWindowHint(GLFW_VERSION_MAJOR, 3); // OpenGL 3.3
               ^^^^^^^^^^^^^^^^^^ nope
glfwWindowHint(GLFW_VERSION_MINOR, 3);
               ^^^^^^^^^^^^^^^^^^ also nope

Use GLFW_CONTEXT_VERSION_MAJOR & GLFW_CONTEXT_VERSION_MINOR instead.

As per the docs, emphasis mine:

GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.

Note: Do not confuse these hints with GLFW_VERSION_MAJOR and GLFW_VERSION_MINOR, which provide the API version of the GLFW header.