修复“没有匹配的函数来调用...”错误?

时间:2019-06-11 04:19:37

标签: c++ opengl codeblocks glut glui

我正在尝试在Codeblocks中运行this .cpp文件(只是更改是在Windows.h开头添加#include)。

它使用OpenGL,GLUT和GLUI。我认为我已经使OpenGL和GLUT在代码块中工作,但是GLUI仍然给我一些问题。首先,我从here下载GLUI,并将glui.h复制到C:\Program Files (x86)\CodeBlocks\MinGW\include\GL

我在第455行出现错误:

void control_cb( int control ){

    if (control == 5){
    GLUI_Master.close_all();
    (...)
};

表示存在对GLUI_Master的未定义引用。

然后我意识到GitHub存储库中也有a GLUI header file,所以我删除了另一个头文件,并将这个新的头文件复制到了与上述相同的位置。

我现在可以走得更远,在第508行出现错误:

void createSettingsMenu(){
    (...)
    new GLUI_Button( settings, "Update", 5,control_cb);
    //settings->set_main_gfx_window(mainWindow);
    (...)
};

表示没有匹配的函数可以调用:

GLUI_Button::GLUI_Button(GLUI*&, const char [7], int, void(&) (int)).

我不确定这是什么意思,但它还会显示

**note: candidate: GLUI_Button::GLUI_Button()
  note: candidate expects 0 arguments, 4 provided** 

围绕第847行:

GLUI_Button( void ) {
    sprintf( name, "Button: %p", this );
    type         = GLUI_CONTROL_BUTTON;
    h            = GLUI_BUTTON_SIZE;
    w            = 100;
    alignment    = GLUI_ALIGN_CENTER;
    can_activate = true;
};

我假设这与错误有关,但我不确定如何解决-我认为此错误肯定是由使用Codeblocks设置GLUI中的问题引起的。

0 个答案:

没有答案