Re: How to add #include <gtk/gtk.h> to existing work



On Wed, Aug 19, 2009 at 07:53:05AM -0700, Monchai Lertsutthiwong wrote:
In order to use GTK as a GUI for my existing work in C language, I need
to add "gtk.h" and "glib.h" to the include files on my existing work.

However, I don't know how to embed these two include files properly
into the makefile of existing work. Do you have the experience for that? If yes, please give me a shot for 
help. 

There is a huge number of examples how to do this in public code
repositories, you can look at essentially any Gnome application written
in C.

In brief:

configure.ac:
    # Require Gtk+ version at least 2.8.0
    PKG_CHECK_MODULES(GTK,[gtk+-2.0 >= 2.8.0])

Makefile.am:
    # Add Gtk+ compiler and linker flags
    AM_CFLAGS = ... $(GTK_CFLAGS)
    foo_LDADD = ... $(GDK_LIBS)

With this, compiling and linking of a simple Gtk+ program (called foo)
should work.

Yeti




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]