A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
C2084 means a function was defined more than once.
In this code, the problem is the function name glutInit:
void glutInit(int* argcp, char** argv)
glutInit is already provided by the GLUT library, so writing a function with that same signature creates a second definition. The compiler reports that the function already has a body.
Use a different name for the function that sets up the window, for example:
void display(void)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glFlush();
}
void initWindow(int* argc, char** argv)
{
glutInit(argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(100, 200);
glutInitWindowSize(800, 700);
glutCreateWindow("This is a window title");
glutDisplayFunc(display);
glutIdleFunc(display);
}
int main(int argc, char** argv)
{
initWindow(&argc, argv);
glutMainLoop();
return 0;
}
Also make sure the needed OpenGL headers are included:
- Core OpenGL:
<GL\gl.h> - GLU:
<GL\glu.h> - WGL and Windows support:
Windows.h
References: