# OpenGL: glut.h error

This is a discussion on OpenGL: glut.h error within the C++ Programming forums, part of the General Programming Boards category; I'm just learning some beginning OpenGL, and I found a site online with an example on how to create a ...

1. ## OpenGL: glut.h error

I'm just learning some beginning OpenGL, and I found a site online with an example on how to create a window, but when I try to compile it I get this error:

Error E2337 c:\Program Files\Borland\Bcc55\include\Gl/glut.h 146: Only one of a set of overloaded functions can be "C"

Here's the source code, if it helps.

Code:
```#include <windows.h>
#include <Gl/glut.h> //include the glut header file

void display (void) {
glClearColor (0.0,0.0,0.0,1.0); //clear the color of the window
glClear (GL_COLOR_BUFFER_BIT); //Clear teh Color Buffer (more buffers later on)
glLoadIdentity();  //load the Identity Matrix
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //set the view
glFlush(); //flush it all to the screen
}

int main (int argc, char **argv) {
glutInit (&argc, argv); //initialize the program.
glutInitDisplayMode (GLUT_SINGLE); //set up a basic display buffer (only singular for now)
glutInitWindowSize (500, 500); //set whe width and height of the window
glutInitWindowPosition (100, 100); //set the position of the window
glutCreateWindow ("A basic OpenGL Window"); //set the caption for the window
glutDisplayFunc (display); //call the display function to draw our world
glutMainLoop (); //initialize the OpenGL loop cycle
return 0;
}```
Any idea why I'm getting this error, or how to fix it?

2. > Error E2337 c:\Program Files\Borland\Bcc55\include\Gl/glut.h 146:
If you look at that line number, in that file, you'll see #error
You'll also see a lot of #if #else type stuff as well.

The #error usually results from the compiler failing to pick any of the other choices.
What you need to do is figure out how to make it choose otherwise.

3. Here's what's at line 146:

Code:
`extern _CRTIMP void __cdecl exit(int);`

Popular pages Recent additions