GTK + Interface Design
First look at a routine:
------------------------------
# Include <GTK/GTK. h> <br/> int main (INT argc, char * argv []) {<br/> gtkwidget * window; <br/>/* initialize GTK + and all of its supporting libraries. */<br/> gtk_init (& argc, & argv); <br/>/* Create a new window, give it a title and display it to the user. */<br/> window = gtk_window_new (gtk_window_toplevel); <br/> gtk_window_set_title (gtk_window (window), "Hello GTK"); <br/> gtk_widget_show (window ); <br/>/* hand control over to the main loop. */<br/> gtk_main (); <br/> return 0; <br/>}
------------------------------
Can be saved as try. c
Compilation process:
1) under the command line
Input:
PKG-config -- cflags GTK ++-2.0
Get:
-MMS-bitfields-ic:/GTK/include/gtk-2.0-ic:/GTK/lib/gtk-2.0/include-ic:/GTK/include/atk-1.0-ic: /GTK/include/Cairo-ic:/GTK/include/pango-1.0-ic:/GTK/include/glib-2.0-ic: /GTK/lib/glib-2.0/include-ic:/GTK/include/libpng12
Input:
PKG-config-libs GTK +-2.0
Get:
-LC:/GTK/lib-lgtk-win32-2.0-lgdk-win32-2.0-latk-1.0-lgio-2.0-lgdk_pixbuf-2.0-lpangowin32-1.0-lgdi32-lpangocairo-1.0-lpango-1.0-lcairo-lgobject-2.0-lgmodule-2.0-lglib-2.0-lintl
Both sections are the library paths required for GCC to compile try. C.
2) Compile with GCC
The command is as follows:
Gcc-o try. c-MMS-bitfields-ic:/GTK/include/gtk-2.0-ic:/GTK/lib/gtk-2.0/include-ic:/GTK/include/atk-1.0-ic: /GTK/include/Cairo-ic:/GTK/include/pango-1.0-ic:/GTK/include/glib-2.0-ic: /GTK/lib/glib-2.0/include-ic:/GTK/include/libpng12-LC: /GTK/lib-lgtk-win32-2.0-lgdk-win32-2.0-latk-1.0-lgio-2.0-lgdk_pixbuf-2.0-lpangowin32-1.0-lgdi32-lpangocairo-1.0-lpango-1.0-lcairo-lgobject-2.0-lgmodule-2.0-lglib-2.0-lintl
Note: gcc-o try. C is followed by the two library paths obtained earlier.
Run successfully and generate try.exe
Run the following command: