Results 1 to 2 of 2

Thread: popup menu callback not declared in the scope

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    15

    popup menu callback not declared in the scope

    im trying to create a popup menu, but when i try to register the callback for the menu, i get this error...

    minicad.cpp: In function ‘void mouse(int, int, int, int)’:
    minicad.cpp:43: error: ‘selectObject’ was not declared in this scope

    here is my code....

    void mouse(int button, int state, int x, int y){
    glutCreateMenu(selectObject);
    glutAddMenuEntry("Sphere",1);
    glutAddMenuEntry("Cube",2);
    glutAddMenuEntry("Torus",3);
    glutAddMenuEntry("Iconsahedron",4);
    glutAddMenuEntry("Octahedron",5);
    glutAddMenuEntry("Tetrahedron",6);
    glutAddMenuEntry("Dodecahedron",7);
    glutAddMenuEntry("Cone",;
    glutAddMenuEntry("Teapot",9);
    glutAttachMenu(GLUT_RIGHT_BUTTON);
    }

    void selectObject(int id){
    glutPostRedisplay();
    }

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: popup menu callback not declared in the scope

    Functions are not visible before they are declared. Either move "selectObject" in front of "mouse" or add a prototype:

    Code :
    void selectObject(int);
     
    void mouse(int button, int state, int x, int y) {
     ...
    }
     
    void selectObject(int id) {
     ...
    }
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

Similar Threads

  1. error: ‘glGenBuffers’ was not declared in this scope
    By colagl in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-28-2016, 02:17 AM
  2. glTexStorage - was not declared in this scope
    By sajis997 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-27-2014, 10:41 AM
  3. 'glMapBuffer' was not declared in this scope
    By saman_artorious in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 06-26-2013, 04:41 AM
  4. GLT_ATTRIBUTE_COLOR was not declared in this scope
    By bcthund in forum OpenGL: GLSL
    Replies: 0
    Last Post: 11-11-2010, 05:37 PM
  5. glGenBuffers’ was not declared in this scope
    By mikethebike in forum OpenGL: Linux
    Replies: 1
    Last Post: 11-30-2009, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean