0

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++?

valiano
  • 16,433
  • 7
  • 64
  • 79
Aarkan
  • 3,811
  • 6
  • 40
  • 54

3 Answers3

3

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)
Jonathan Callen
  • 11,301
  • 2
  • 23
  • 44
0

Try including glib:

gcc renderSVG.cc -I/usr/include/librsvg-2.0/librsvg/ -I/usr/include/glib-2.0
Blender
  • 289,723
  • 53
  • 439
  • 496
  • As i mentioned in question, I have tried this, but get another error: gcc renderSVG.cc -I/usr/include/librsvg-2.0/librsvg/ -I/usr/include/glib-2.0/ In file included from /usr/include/glib-2.0/glib/galloca.h:34:0, from /usr/include/glib-2.0/glib.h:32, from /usr/include/glib-2.0/gobject/gbinding.h:30, from /usr/include/glib-2.0/glib-object.h:25, from /usr/include/librsvg-2.0/librsvg/rsvg.h:29, from renderSVG.cc:1: /usr/include/glib-2.0/glib/gtypes.h:34:24: fatal error: glibconfig.h: No such file or directory – Aarkan Sep 24 '11 at 04:39
  • I found the solution: Correct command line is: gcc pkg-config --cflags --libs librsvg-2.0 renderSVG.cc – Aarkan Sep 24 '11 at 04:52
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@