[cairo] libraries required

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Sat Jul 11 22:54:05 PDT 2009


Hi David,

On Sat, 11 Jul 2009, David Smead wrote:

> I wanted to try cairo using gtk so a I found some examples on the web.

Others who actually know about GTK can probably help with your actual 
question about which libraries the symbols you're looking for are in,
but I wanted to mention the awesome power of pkg-config which you seem 
not to be using.  The pkg-config program can query your system for 
whatever libraries and compilation flags a top level module requires. 
For example when using GTK the simplest way to compile an app is 
something like this:

gcc `pkg-config --cflags --libs gtk+-2.0` -Wall -W app.c -o app

That expands to something horrific including all the dependencies that 
you need not worry about anymore.  Actually, the pkg-config bit 
expands here to

-D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include 
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include 
-I/usr/include/freetype2 -I/usr/include/directfb 
-I/usr/include/libpng12 -I/usr/include/pixman-1  -lgtk-x11-2.0 
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 
-lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0  

Cheers,

Joonas

P.S. The objdump program can list all the symbols of a shared library. 
e.g. objdump -T libgtk-x11-2.0.so | grep gtk_window_get_size


More information about the cairo mailing list