c++clinuxsvglibrsvg

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

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


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)