星期日, 7月 16, 2006

How to develop GTK2 program on windows

1.download files
all files coming from http://www.gimp.org/~tml/gimp/win32/downloads.html
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/glib-2.6.5.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/glib-dev-2.6.5.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/gtk+-2.6.8.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/gtk+-dev-2.6.8.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/pango-1.8.0.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/pango-dev-1.8.0.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/atk-1.9.0.zip
ftp://ftp.gtk.org/pub/gtk/v2.6/win32/atk-dev-1.9.0.zip

2.extract them to the same directory
my case is D:\work\test\vc\gtk2\devel

3.edit your environment variable
call System Properties dialog
call System Properties dialog



press Enviorment variable button
press Enviorment variable button



add a system variable GTK2DEVEL
add a system variable GTK2DEVEL


append your devel directory to Path variable
append your devel directory to Path variable

4.start your VC6
start your VC6


5.new a Win32 Console Application
new a Win32 Console Application

6.choose An empty project.
choose An empty project.

7.Insert a file into project named "hello.c"
Insert a file into project named hello.c

8.copy and paste the hello world code and save
here is the code
http://www.gtk.org/tutorial/ch-gettingstarted.html#SEC-HELLOWORLD


9.choose menu /Project/Settings and C/C++ tab with Category Code Generation then modify Use run-time library to Debug Multithreaded DLL


10.choose Category Preprocessor then modify Additional include directories to
$(GTK2DEVEL)/include,$(GTK2DEVEL)/include/gtk-2.0,$(GTK2DEVEL)/include/glib-2.0,$(GTK2DEVEL)/lib/glib-2.0/include,$(GTK2DEVEL)/include/pango-1.0,$(GTK2DEVEL)/lib/gtk-2.0/include,$(GTK2DEVEL)/include/atk-1.0


11.change to Link tab and Category Input then append Object/library modules with
gobject-2.0.lib glib-2.0.lib gtk-win32-2.0.lib gdk-win32-2.0.lib gdk_pixbuf-2.0.lib iconv.lib


12.modify Additional library path to
$(GTK2DEVEL)/lib


13.compile it


14.run and hello world

沒有留言: