I'm trying to run an simple Gtkmm program but I'm failing to get the content to the GlibRef. Here's a sample code:
#include <gtkmm-3.0/gtkmm.h>
int main(int argc, char** argv)
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create (argc, argv, "org.me.myprogram");
Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("gladefile.glade");
Glib::RefPtr<Gtk::ApplicationWindow> myMainWindow= builder->get_object("myGTkApplicationWindowID");
app->run(myMainWindow, argc, argv);
return 0;
}
This gives me the following error(showing the important part):
error: no matching function for call to ‘Gtk::Application::run(Glib::RefPtr<Gtk::ApplicationWindow>&, int&, char**&)
note: no known conversion for argument 1 from ‘Glib::RefPtr<Gtk::ApplicationWindow>’ to ‘Gtk::Window&
Trying to use *myMainWindow doesn't work because this operator is not defined, the operator-> is defined but doesn't work because it goes deeper than needed, showing the following error:
error: no matching function for call to ‘Gtk::Application::run(Gtk::ApplicationWindow*, int&, char**&)’
note: no known conversion for argument 1 from ‘Gtk::ApplicationWindow*’ to ‘Gtk::Window&’
Even tried more wild things like &(myMainWindow.operator()) and *(myMainWindow.operator()), but I believe I'm missing the ideia of this smart pointer. So how to make it work? AFAIK GTKMM should work very easily with Glib::RefPtr.