2011-02-01 2 views
0

나는 글루를 처음 사용합니다. 나는 글루 menubar를 만들 수 없습니다. 나는 glui의 도구 모음을 만들 때마다 나는 다음과 같은 오류를 얻을 :글루 menubar를 사용하여

1.cpp:13: error: expected constructor, destructor, or type conversion before ‘*’ token 
1.cpp: In function ‘void controlcallback(int)’: 
1.cpp:42: error: ‘m’ was not declared in this scope 
1.cpp:42: error: expected type-specifier before ‘GLUI_MenuBar’ 
1.cpp:42: error: expected `;' before ‘GLUI_MenuBar’ 

소스 : 오류가 m1.cpp:42: error: ‘m’ was not declared in this scope 정말 어디 선언되지 않은 컴파일러에 의해 정확하게보고로

int main_window; 
GLUI *w1; 
GLUI_Listbox *l1; 
GLUI_Button *b1,*b2,*b3,*b4,*b5,*b6,*b7,*b8; 
GLUI_Panel *p1,*p2; 
enum GLUI_MenuBar *m1; 

int id; 

void init() 
{ 
    glClearColor(0,1,1,0); 
} 

void display() 
{ 
    glClear(GL_COLOR_BUFFER_BIT); 
    glFlush(); 
    glutPostRedisplay(); 
} 

void reshape (int w, int h) 
{ 
    GLUI_Master.auto_set_viewport(); 
} 

void controlcallback(int val) 
{ 

    if(val == 1) { 
     w1->set_main_gfx_window(main_window); 
     m=new GLUI_MenuBar(p1); 
    } else { 
     w1->set_main_gfx_window(main_window); 
    } 
} 

int main(int a, char **b) 
{ 
    glutInit(&a,b); 
    glutInitWindowSize(3000,3000); 
    glutInitWindowPosition(0,0); 
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); 

    main_window = glutCreateWindow(" practice"); 
    init(); 
    glutDisplayFunc(display); 


    GLUI_Master.set_glutReshapeFunc(reshape); 
    w1=GLUI_Master.create_glui_subwindow(main_window,GLUI_SUBWINDOW_TOP); 
    id=w1->get_glut_window_id(); 
    p1=w1->add_panel("",GLUI_PANEL_RAISED); 
    b1=w1->add_button_to_panel(p1,"navigator",1,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b2=w1->add_button_to_panel(p1,"naigator",2,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b3=w1->add_button_to_panel(p1,"navigator",3,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b4=w1->add_button_to_panel(p1,"naigator",4,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b5=w1->add_button_to_panel(p1,"navigator",5,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b6=w1->add_button_to_panel(p1,"naigator",6,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b7=w1->add_button_to_panel(p1,"navigator",7,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    b8=w1->add_button_to_panel(p1,"naigator",8,controlcallback); 
    w1->add_column_to_panel(p1,true); 
    GLUI_MenuBar *m1 = new GLUI_MenuBar(id,GLUI_SUBWINDOW_TOP); 

    w1->set_main_gfx_window(main_window); 
    glutMainLoop(); 
} 

답변

1

글쎄.

다른 오류 1.cpp:13: error: expected constructor, destructor, or type conversion before ‘*’ token은 (는) GLUI_Listbox에 글루 헤더를 포함하는 것을 잊어 버린 것처럼 들립니다.

현재 글로벌 변수 m1에 섀도우 잉하고있는 것은 GLUI_MenuBar *m1 = new GLUI_MenuBar(id,GLUI_SUBWINDOW_TOP);입니다.

+0

glui MenuBar의 포인터 인 m1과 m을 변경했습니다. 열거 형을 제거했지만 여전히 같은 문제가 발생합니다. 내 도구 모음이 작동하지 않는 버전 문제일까요? 내가 glui 2.36 버전을 사용하고 있습니다. – Shweta

관련 문제