Reputation: 181
Could someone please show me an example of how to use the Gtkmm function g_timeout_add. I tried calling it like this: g_timeout_add(100, &MainWindow::callbackFunc, processed);
but I get the error:
error: cannot convert ‘gboolean (MainWindow::*)(std::__cxx11::string) {aka int (MainWindow::*)(std::__cxx11::basic_string<char>)}’ to ‘GSourceFunc {aka int (*)(void*)}’ for argument ‘2’ to ‘guint g_timeout_add(guint, GSourceFunc, gpointer)’
g_timeout_add(100, &MainWindow::callbackFunc, processed);
And if I try to call it without the & (g_timeout_add(100, MainWindow::callbackFunc, processed);
), then I get the following error:
error: invalid use of non-static member function
g_timeout_add(100, MainWindow::callbackFunc, processed);
The callback function is defined as:
gboolean callbackFunc(std::string data);
Upvotes: 0
Views: 727
Reputation: 1
Read the timeout section of the GtkMM tutorial documentation
Upvotes: 2