[cairo] help to compile an example pangocairo.h

Tor Lillqvist tml at iki.fi
Fri Sep 17 00:12:50 PDT 2010


> gcc -Wall -g -I/usr/include/cairo -lcairo -I/usr/include/pango-1.0 -lpango-1.0 -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 pango4.c -o pango4

You don't link to the pangocairo library, which is where the
pango_cairo_ functions are. Try adding -lpangocairo

You should really learn to put the the library (-l) options after the
object files (or in this simple case, the single source file) that
need them. It just is the more correct style, even if it might work on
some platforms not to. Also, it is very customary to put the output
file name relatively early on the linking command line. Why ignore
conventions?

And really, you should learn to use pkg-config.

Like this:

gcc -Wall -g -o pango4 `pkg-config --cflags pangocairo` pango4.c
`pkg-config --libs pangocairo`

(Try putting an "echo" command in front of that to see what it expands to.)

--tml


More information about the cairo mailing list