openGL报错,在已经调用的情况下提示未调用

最近在看openGL,粘贴的ppt的代码报了个很奇怪的错误

#include <windows.h>  // For MS Windows
#include <GL/glut.h>  // GLUT, includes glu.h and gl.h

/* Handler for window-repaint event. Call back when the window first appears and whenever the window needs to be re-painted. */
void display() {
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set background color to black and opaque
    glClear(GL_COLOR_BUFFER_BIT);         // Clear the color buffer
 /* Main function: GLUT runs as a console application starting at main()  */
    int main(int argc, char** argv) {
        glutInit(&argc, argv);                 // Initialize GLUT
        glutCreateWindow("OpenGL Basic Setup Test"); // Create a window with the given title
        glutInitWindowSize(320, 320);   // Set the window's initial width & height
        glutInitWindowPosition(50, 50); // Position the window's initial top-left corner
        glutDisplayFunc(display); // Register display callback handler for window re-paint
        glutMainLoop();           // Enter the infinitely event-processing loop
        return 0;
    }

}

报错是
freeglut  ERROR:  Function <glutCreateWindow> called without first calling 'glutInit'.

问题是在main里第一个就调用的是glutInit啊?

解决啦,我把glut重新配置了一下,发现是我下载的glut库不全,才会有这个问题