The following program, which is based on the Gtkmm Hello World, crashes on my system.
Details: - Fedora Core 5, updated - gtkmm24 and gtkmm24-devel RPMs (version 2.8.9-1.fc5, 10 Oct 2006) installed with yum from Fedora Extras - g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-51) - Hello World: http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch03s06.html My (single) source file (foo.cpp): ---------------------------------------------------------------------- #include <gtkmm/button.h> #include <gtkmm/window.h> #include <iostream> #include <gtkmm/main.h> class HelloWorld : public Gtk::Window { public: HelloWorld(); virtual ~HelloWorld(); protected: //Signal handlers: virtual void on_button_clicked(); //Member widgets: Gtk::Button m_button; }; HelloWorld::HelloWorld() : m_button("Hello World") // creates a new button with the label "Hello World". { // Sets the border width of the window. set_border_width(10); // When the button receives the "clicked" signal, it will call the // on_button_clicked() method. The on_button_clicked() method is defined below. m_button.signal_clicked().connect(sigc::mem_fun(*this, &HelloWorld::on_button_clicked)); // This packs the button into the Window (a container). add(m_button); // The final step is to display this newly created widget... m_button.show(); } HelloWorld::~HelloWorld() { } void HelloWorld::on_button_clicked() { std::cout << "Hello World" << std::endl; } int main (int argc, char *argv[]) { Gtk::Main kit(argc, argv); HelloWorld helloworld; Gtk::Main::run(helloworld); //Shows the window and returns when it is closed. return 0; } ---------------------------------------------------------------------- Compilation: g++ -g -Wall foo.cpp `pkg-config --cflags --libs gtkmm-2.4` where `pkg-config --cflags --libs gtkmm-2.4` is this: -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/include/atkmm-1.6 -I/usr/include/gtk-2.0 -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/atk-1.0 -lgtkmm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-x11-2.0 -lpangomm-1.4 -lglibmm-2.4 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 Execution, with the crash at "add(m_button)": ---------------------------------------------------------------------- elise:~/cvswork/gtkmm-example/src 0 $ gdb a.out GNU gdb Red Hat Linux (6.3.0.0-1.134.fc5rh) [...] (gdb) run Starting program: /home/ps/cvswork/gtkmm-example/src/a.out Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xd74000 Program received signal SIGSEGV, Segmentation fault. 0x0079f602 in Gtk::Container_Class::add_callback () from /usr/lib/libgtkmm-2.4.so.1 (gdb) where #0 0x0079f602 in Gtk::Container_Class::add_callback () from /usr/lib/libgtkmm-2.4.so.1 #1 0x00a776e9 in g_cclosure_marshal_VOID__OBJECT () from /usr/lib/libgobject-2.0.so.0 #2 0x00a697a9 in g_value_set_static_boxed () from /usr/lib/libgobject-2.0.so.0 #3 0x00a6af8b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #4 0x00a7c2ca in g_signal_override_class_closure () from /usr/lib/libgobject-2.0.so.0 #5 0x00a7d347 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #6 0x00a7d509 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #7 0x04a0cabc in gtk_container_add () from /usr/lib/libgtk-x11-2.0.so.0 #8 0x0079ff86 in Gtk::Container::add () from /usr/lib/libgtkmm-2.4.so.1 #9 0x0804aab2 in HelloWorld (this=0xbff19ae4) at foo.cpp:32 #10 0x0804ab8b in main (argc=9112272, argv=0xbff10001) at foo.cpp:51 (gdb) quit ---------------------------------------------------------------------- Where should I go from here? Are those RPMs any good? Thanks. -- Pierre Sarrazin <sarrazip @ sarrazip . com> _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
