Question

I am using librsvg in my C files to rasterize SVG, but as soon as I include rsvg.h, I start to get the following error:

/usr/include/librsvg-2.0/librsvg/rsvg.h:29:25: fatal error: glib-object.h: No such file or directory

  1. Does anyone know why it is happenning and how to get rid of it? I tried including the path of glib headers but then it again starts to report other missing headers.

  2. Is there any other open source library which I can use for rasterizing the SVG in C/C++?

Était-ce utile?

La solution

You might want to use pkg-config to get the proper flags to add, like this:

g++ -c -o renderSVG.o renderSVG.cc $(pkg-config --cflags librsvg-2.0)
g++ -o renderSVG renderSVG.o $(pkg-config --libs librsvg-2.0)

Autres conseils

Try including glib:

gcc renderSVG.cc -I/usr/include/librsvg-2.0/librsvg/ -I/usr/include/glib-2.0

I have the same problem using autotools on Ubuntu Natty. I have added in configure.ac

PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= 2.0,
            [],
            [AC_MSG_FAILURE([librsvg not found])]
            )

and in Makefile.am

myexe_CFLAGS=@LIBRSVG_CFLAGS@ 
myexe_LDFLAGS=@LIBRSVG_LIBS@
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top