[cairo] help to compile an example pangocairo.h

Andrea Canciani ranma42 at gmail.com
Fri Sep 17 00:10:41 PDT 2010


On Fri, Sep 17, 2010 at 8:24 AM, andrew james
<andrew at systemssingular.com> wrote:
> I only wanted to try this short example, that fails to compile.  No compile
> instructor was written in the example, I tried until an hour but the error
> is 'undefined reference' to a few functions in 'pangocairo.h'
>
> error
>
> /tmp/ccvDU65O.o: In function `draw_text':
> /programs/c/pango4.c:20: undefined reference to `pango_cairo_create_layout'
> /programs/c/pango4.c:37: undefined reference to `pango_cairo_update_layout'
> /programs/c/pango4.c:40: undefined reference to `pango_cairo_show_layout'
> collect2: ld returned 1 exit status
>
>
> from compile instructor that I wrote after some research
>
> 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

I think you're missing some libraries (in particular, it looks like
you're not linking
to pangocairo). You'd better use pkg-config:

gcc -Wall -g pango4.c -o pango4 $(pkg-config --cflags --libs pangocairo)

Andrea


More information about the cairo mailing list