So I’m trying to get GLFW to work with the simplest code possible:
#include
#include <GLFW/glfw3.h>using namespace std;
void error_callback(int error, const char* description)
{
fprintf(stderr, “Error: ‘%s’\n”, description);
}int main() {
glfwSetErrorCallback(error_callback);if (!glfwInit()) { std::cout << "Error: glfwInit" << std::endl; } else { std::cout << "Succes: glfwInit" << std::endl; } return 0;
}
Sadly, running this code returns the following error:
Error: ‘Wayland: Failed to connect to display’
This seems weird, because I am not using wayland.
echo $XDG_SESSION_TYPE
gives me x11, so i would expect glfwInit() to use that, instead of wayland. Does anyone know how to fix this problem? I am using ubuntu 18.04.