An example of using Cairo::SvgSurface class to render to SVG
#if defined(_MSC_VER)
#define _USE_MATH_DEFINES
#endif 
#include <string>
#include <iostream>
#include <cairommconfig.h>
#include <cairomm/context.h>
#include <cairomm/surface.h>
#include <cmath>
int main()
{
#ifdef CAIRO_HAS_SVG_SURFACE
    double width = 600;
    double height = 400;
    auto surface =
    cr->save(); 
    cr->set_source_rgb(0.86, 0.85, 0.47);
    cr->paint();    
    cr->restore();  
    cr->save();
    
    cr->set_line_width(20.0);    
    cr->rectangle(0.0, 0.0, cairo_image_surface_get_width(surface->cobj()), height);
    cr->stroke();
    cr->set_source_rgba(0.0, 0.0, 0.0, 0.7);
    
    cr->arc(width / 2.0, height / 2.0, 
            height / 4.0, 0.0, 2.0 * M_PI);
    cr->stroke();
    
    cr->move_to(width / 4.0, height / 4.0);
    cr->line_to(width * 3.0 / 4.0, height * 3.0 / 4.0);
    cr->stroke();
    cr->restore();
    cr->show_page();
    std::cout << 
"Wrote SVG file \"" << filename << 
"\"" << 
std::endl;
 
    return 0;
#else
    std::cout << "You must compile cairo with SVG support for this example to work."
    return 1;
#endif
}