When using cairo_svg_surface_create in exactly the same fashion as cairo_ps_surface_create (which has an identical API in the documentation) I get a warning from the former but never have for the latter: assignment makes pointer from integer without a cast Something seems to be either wrong with the documentation or the code for cairo_svg_surface_create; however, my program still functions fine anyway. It would be nice to not have the warning appear when compiling though. Here is the code that uses it: gboolean plot_linear_print_eps(GtkWidget *plot, gchar* fout) { cairo_t *cr; cairo_surface_t *surface; surface=cairo_ps_surface_create(fout, (gdouble) (plot->allocation.width), (gdouble) (plot->allocation.height)); cairo_ps_surface_set_eps(surface, TRUE); cairo_ps_surface_restrict_to_level(surface, CAIRO_PS_LEVEL_2); cr=cairo_create(surface); draw(plot, cr); cairo_surface_show_page(surface); cairo_destroy(cr); cairo_surface_finish(surface); cairo_surface_destroy(surface); return FALSE; } gboolean plot_linear_print_svg(GtkWidget *plot, gchar* fout) { cairo_t *cr; cairo_surface_t *surface; surface=cairo_svg_surface_create(fout, (gdouble) (plot->allocation.width), (gdouble) (plot->allocation.height)); cr=cairo_create(surface); draw(plot, cr); cairo_destroy(cr); cairo_surface_destroy(surface); return FALSE; }
#include <cairo-svg.h> ?
(In reply to comment #1) > #include <cairo-svg.h> ? Not directly. I'm wrapping cairo in via GTK and my CAIRO_HAS_SVG_SURFACE variable is enabled. The program is able to still render to svg fine, just I get this warning. It is strange as both cairo-svg.h and cairo-ps.h both have the same declarations for their surface_create functions so I don't know why the compiler would treat them differently. I get it on both computers I've got one with 1.8.10 and the other with 1.10.2
(In reply to comment #2) > (In reply to comment #1) > > #include <cairo-svg.h> ? > > Not directly. What do you mean? So you don't include cairo-svg.h? That's why you get the warning.
ok seems to do it. How come the include isn't listed in the API? Guess I must just be lazy being used to the GTK API where that's all listed. Also would have thought the compiler would have a different warning. Anyway just excuses for feeling like a fool I guess. Sorry for bothering you guys and thanks for replying so quickly.
You want -Wmissing-declarations to get useful warnings for that, though I think -Wall should warn about the function not being defined already.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.