出现的错误是未定义的符号,不是我从示例中复制的Cairo函数,而是我猜测是内部函数。我已经查看了周围,并尝试使用终端中一个常见的在线示例中verbatim的$(pkg-config --cflags --libs cairo)。
在使用EXPORT=(我的cairos .ps文件路径)之后,我尝试了这个。
在链接器设置中,我目前在CodeBlocks中有一个选项“链接库”:
在使用EXPORT=(我的cairos .ps文件路径)之后,我尝试了这个。
在链接器设置中,我目前在CodeBlocks中有一个选项“链接库”:
/usr/lib/x86-linux-gnu/libcairo.a
此外,我还在编译器选项中添加了/usr/include/cairo
。
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.