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. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    8

    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. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    > 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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    8
    Here's what's at line 146:

    Code:
    extern _CRTIMP void __cdecl exit(int);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21