The errors that show up are for undefined symbols, not the Cairo functions I copied from the example, but what I guess are internal functions. I have looked around and tried using $(pkg-config --cflags --libs cairo), verbatim from a common online example using the terminal.
I tried that after using EXPORT=(my path to cairos .ps file).
I currently have one option in CodeBlocks 'Link Libraries' in the linker settings:
/usr/lib/x86-linux-gnu/libcairo.a
Also, I have /usr/include/cairo
in my compiler options.
Errors:
/usr/lib/x86_64-linux-gnu/libcairo.a(cairo-image-source.o)||In function _cairo_image_source_finish':|
(.text+0x1c)||undefined reference to
pixman_image_unref'|
Plus 50 more like it.
Which are generated from the following, main.c:
include cairo.h (with # and <>)
int main()
{
cairo_surface_t *surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80);
cairo_t *cr =
cairo_create (surface);
cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 32.0);
cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
cairo_move_to (cr, 10.0, 50.0);
cairo_show_text (cr, "Hello, world");
cairo_destroy (cr);
cairo_surface_write_to_png (surface, "hello.png");
cairo_surface_destroy (surface);
return 0;
}
Any help fixing and understanding what's going on would be greatly appreciated.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…