This is my program:
#include <gtkmm.h>
int main (int argc, char* argv[])
{
Gtk::Main gtkmain(argc, argv);
Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("practice_1_builder.glade");
Gtk::Window win;
builder->get_widget("winobj", win);
Gtk::Main::run(win);
return EXIT_SUCCESS;
}
I use this command in terminal to compile it, as I use for any other GTK+ program I can correctly compile:
g++ myprog.cpp -o myprog `dpkg-config --cflags --libs gtkmm-3.0`
And I get this error:
builder_0.cpp: In function ‘int main(int, char**)’:
builder_0.cpp:10:35: error: no matching function for call to ‘Gtk::Builder::get_widget(const char [7], Gtk::Window&)’
builder_0.cpp:10:35: note: candidate is:
/usr/include/gtkmm-3.0/gtkmm/builder.h:435:8: note: template<class T_Widget> void Gtk::Builder::get_widget(const Glib::ustring&, T_Widget*&)
I tried many twiddles, defining win as pointer, converting the string literal to Glib::ustring, …, but didn’t work.
Appreciating helps! 🙂
The message is very clear to me. T_Widget*& means, that you have to pass a (reference to a ) pointer. I changed your code to this:
Now it should work as expected.