|
[code:1]
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
void on_window_destroy (GtkObject *object,gpointer user_data)
{
printf("\a Good Bye!\n");
gtk_exit(0);
}
int main(int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *button;
gtk_set_locale ();
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (window, "window");
gtk_window_set_title (GTK_WINDOW (window), "Say hello to GTK+");
gtk_signal_connect (GTK_OBJECT (window), "destroy",GTK_SIGNAL_FUNC (on_windo
w_destroy),NULL);
gtk_widget_show_all(window);
gtk_main();
}
[/code:1]
========makefile==========
CC = gcc -g
all: hellogtk
hellogtk: hellogtk.o
$(CC) `gtk-config --libs` hellogtk.o -o hellogtk
hellogtk.o: main.c
$(CC) `gtk-config --cflags` -c main.c -o hellogtk.o
clean:
rm hellogtk *.o |
|