Question

I want to connect a signal to window.signal_delete_event, but it fails with the following error messages:

  • no match for call to ‘(sigc::bound_mem_functor0) (_GdkEventAny* const&)’ OpticalInput
  • return-statement with a value, in function returning 'void' [-fpermissive]
  • void value not ignored as it ought to be

That is the code line causing the error:

window.signal_delete_event().connect(sigc::mem_fun(this,&GUIWindow::onExitClicked));

The pointed member function is this one:

void GUIWindow::onExitClicked()
{
    *state = false;
    Gtk::Main::quit();
}

Any ideas on how to fix this?

Was it helpful?

Solution

Your method must match the signature of the signal. In the gtkmm documentation for signal_delete_event(), the following prototype is given:

bool on_my_delete_event(GdkEventAny* event)

Using your naming, the method must be defined as follows:

bool GUIWindow::onExitClicked(GdkEventAny* event) { ... }

The return value is used to indicate whether or not you have completely handled the event. If you return true, other handlers for this event will not see it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top