void standalone_function () { std::cout << "standalone_function" << std::endl; } class MyButton : public Gtk::Button { public: void on_clicked () { std::cout << "on_clicked" << std::endl; } }; int main(int argc, char** argv) { Gtk::Main kit (argc, argv); // if you don't use inheritance, connect to the signal Gtk::Button button1; button2.signal_clicked ().connect (sigc::ptr_fun (&standalone_function)); // this class defines the virtual function on_clicked, which will automatically // run when the signal is emitted, you don't need to explicitly connect it. MyButton button2; Gtk::Main::run (); }