To troubleshoot glfw, define anthe glfw error callback:
void error_callback( int error, const char *msg ) {
std::string s;
s = " [" + std::to_string(error) + "] " + msg + '\n';
std::cerr << s << std::endl;
}
Before initnializing glfw, set the callback:
glfwSetErrorCallback( error_callback );
Give it a few hints:
if( GL_TRUE != glfwInit() )
std::cerr << "Error initialising glfw" << std::endl;
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 5 );
// If you want the opengl debug callbackcontext from 4.3 onwards, which you do:
glfwWindowHint( GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE );
glfwWindowHint( GLFW_CLIENT_API, GLFW_OPENGL_API );
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
And the window should open effortlessly, assuming the OS base with driver works edit: and the function glfwInit() is called instead of its pointer questioned.