how to solve Severity Code Description Project File Line Suppression State Error C3861 'glutCreateWindow': identifier not found OpenGL C:\Users\Asus\OpenGL\OpenGL\test1.cpp 18
时间: 2023-06-28 16:14:19 浏览: 112
The error message you're seeing indicates that the `glutCreateWindow` function was not found by the compiler. This typically means that the appropriate header file has not been included or the necessary libraries have not been linked.
To resolve this issue, you should ensure that you have included the necessary header files and linked the appropriate libraries. Specifically, you need to include the `glut.h` header file and link against the `glut32.lib` library.
Here's an updated version of the example code with the necessary changes:
```
#include <GL/glut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutCreateWindow("OpenGL Test");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
```
Make sure that you have the necessary libraries and header files installed and linked correctly.
阅读全文