我创建了一个非常简单的 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;
}
GL 标头自动从 glfw3.h 标头中包含在 GL/gl.h 中,但它找不到符号。这可以在 glfw 2.x 上找到,但我使用的是最新的。