Compilation error while using librsvg
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
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.
Is there any other 开发者_StackOverflow社区open source library which I can use for rasterizing the SVG in C/C++?
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)
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@
精彩评论