|
以下是我的源代码,一个简单的显示简单窗口的程序:
#include <gtk/gtk.h>
int main (int argc , char *argv[] )
{
GtkWidget *window;
gtk_init ( &argc , &argv );
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
g_signal_connect ( G_OBJECT ( window ), "delete_event",
G_CALLBACK ( gtk_main_quit ), NULL );
gtk_window_set_title(GTK_WINDOW(window),"English.汉字");
gtk_window_set_default_size(GTK_WINDOW(window),500,100);
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
gtk_widget_show(window);
gtk_main();
return FALSE;
}
---------------------
下面是Makefile:
CC = gcc
CFLAGS = -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED
window: window.c
$(CC) window.c -o window `pkg-config gtk+-2.0 --cflags --libs`
请兄弟们看看。 |
|