(A) Ubuntu Gtk2.0 installation 1, first of all, of course, to ensure that the installation of the build-essentialsudoapt-getinstallbuild-essential2, And then, enter the command: sudoapt-getinstalllibgtk2.0-dev can install Gtk development manual sudoapt-getinstalldevhelp # inclu
1) install Gtk2.0 in Ubuntu
1. First of all, make sure that build-essential is installed.
Sudo apt-get install build-essential
2. Run the following command: sudo apt-get install libgtk2.0-dev.
You can install the Gtk development manual sudo apt-get install devhelp.
# Include
Void hello (GtkWidget * widget, gpointer data)
{
G_print ("Hello Ubuntu! \ N ");
}
Gint delete_event (GtkWidget * widget, GdkEvent * event, gpointer data)
{
G_print ("delete event occurred \ n ");
Return (TRUE );
}
Void destroy (GtkWidget * widget, gpointer data)
{
Gtk_main_quit ();
}
Int main (int argc, char * argv [])
{
GtkWidget * window;
GtkWidget * button;
Gtk_init (& argc, & argv );
Window = gtk_window_new (GTK_WINDOW_TOPLEVEL );
Gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (delete_event), NULL );
Gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (destroy), NULL );
Gtk_container_set_border_width (GTK_CONTAINER (window), 10 );
Button = gtk_button_new_with_label ("Hello Ubuntu !, \ NI am Waynebuaa ");
Gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (hello), NULL );
Gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window ));
Gtk_container_add (GTK_CONTAINER (window), button );
Gtk_widget_show (button );
Gtk_widget_show (window);/* display a window */
Gtk_main ();/* enter the main loop */
Return (0 );
}
2) Qt compilation and Installation
Download the qt-everywhere-opensource-src-4.7.2 without compiling demos and examples to save time:
./Configure-release-nomake demos-nomake examples
Make