我试图用 gnome 在 arch linux 上构建一个 glfw 窗口。但是每次我尝试运行应用程序时,它都无法初始化窗口,它只是在 init之前打印,而不是在 init之后打印。
我用 gcc 构建它:
gcc -o app main.c -lglfw -lGLU -lGL -lm
主.c
#include <stdio.h>
#include <GLFW/glfw3.h>
int main() {
GLFWwindow* window;
printf("before init\n");
if (!glfwInit())
return -1;
printf("after init\n");
window = glfwCreateWindow(800, 600, "Hello World", glfwGetPrimaryMonitor(), NULL);
if (!window) {
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window)) {
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(83条)