Opengl glfw3缺少gl参考

Opengl glfw3缺少gl参考,opengl,symbols,glfw,Opengl,Symbols,Glfw,我创建了一个非常简单的glfw3应用程序,但是在编译它时,出现以下错误: test.cpp: In function ‘int main()’: test.cpp:12:11: error: ‘GL_COLOR_BIT_BUFFER’ was not declared in this scope 这是我的密码: #include <GLFW/glfw3.h> int main(void) { GLFWwindow* window; glfwInit();

我创建了一个非常简单的glfw3应用程序,但是在编译它时,出现以下错误:

test.cpp: In function ‘int main()’:
test.cpp:12:11: error: ‘GL_COLOR_BIT_BUFFER’ was not declared in this scope
这是我的密码:

#include <GLFW/glfw3.h>

int main(void) {

    GLFWwindow* window;
    glfwInit();
    glfwCreateWindow(1280, 720, "Hello OpenGL!", NULL, NULL);
    glfwMakeContextCurrent(window);

    while(!glfwWindowShouldClose(window)) {

        glClear(GL_COLOR_BIT_BUFFER);


        glfwSwapBuffers(window);

    }

    glfwTerminate();
    return 0;

}
#包括
内部主(空){
GLFWwindow*窗口;
glfwInit();
glfwCreateWindow(1280720,“你好,OpenGL!”,NULL,NULL);
glfwMakeContextCurrent(窗口);
而(!glfwWindowShouldClose(窗口)){
glClear(GLU颜色位缓冲区);
glfwSwapBuffers(窗口);
}
glfwTerminate();
返回0;
}

GL标题将从glfw3.h标题自动包含在GL/GL.h中,但它找不到符号。这本可以在glfw 2.x上找到,但我使用的是最新的。

你想要的是
GL\u COLOR\u BUFFER\u BIT
,而不是
GL\u COLOR\u BIT\u BUFFER

我的错,我主要是想从内存中重新创建它,但是没有注意到更改。@user2216833-这是因为您没有将
window
设置为从
glfwCreateWindow
返回的指针。