Search code examples
c++functioncallbackgtkmmsignal-handling

Gtkmm 'no matching function for call' errors


I am a beginner and learning Gtkmm by following their official documentation.

But this example: https://developer.gnome.org/gtkmm-tutorial/stable/sec-menus-examples.html.en#menu-example-main

is not working and I am getting these kind of errors:

examplewindow.cc: In constructor ‘ExampleWindow::ExampleWindow()’:
examplewindow.cc:18:67: error: no matching function for call to 
‘Gio::SimpleActionGroup::add_action(const char [12], 
sigc::bound_mem_functor0<void, ExampleWindow>)’
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));
                                                               ^

The above error is pointed for this bit of code:

refActionGroup->add_action("newstandard",
sigc::mem_fun(*this, &ExampleWindow::on_menu_file_new_generic));

But "on_menu_file_new_generic" function does exist. So if the callback function does exist, then how come it says 'no matching function'?

Any help?


Solution

  • This error occurs because of older version of glibmm library. My current version of glibmm is 2.37.4 that does not support this method.

    This overloaded add_action() method first appeared in glibmm 2.37.6, so in order to get past this error I need to install newer version of glibmm.

    Hope others will be able to resolve their errors as well.