Código:
#include <gtk/gtk.h> int main (int argc, char *argv[]) { GtkWidget *janela, *botao; gtk_init(&argc, &argv); janela=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(janela),"Exemplo"); gtk_window_set_default_size(GTK_WINDOW(janela),200,60); botao =gtk_button_new_with_label("Sair"); g_signal_connect(G_OBJECT(botao),"clicked", G_CALLBACK(gtk_main_quit),NULL); gtk_container_add(GTK_CONTAINER(janela),botao); gtk_widget_show_all(janela); gtk_main(); return 0; }
$gcc nomedoprograma.c -o nomedoprograma `pkg-config --cflags --libs gtk+-2.0`
Comment