I did not find any answer online yet so I am asking here:
I am using Win10+msys2+CodeBlocks for Gtkmm applications. Everything is working so far but I found 2 things having linking problems: Gtk::Image, Cairo::select_font_face and some other Cairo font related functions. I can do cr->move_to, cr->line_to etc.
For example the function “cr->select_font_face (“Purisa”, Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD);” can compile but I get this linker error: “undefined symbol … error: ld returned 1 exis status.”.
What could be wrong? Other Cairo functions work and I believe all come from the same library. Do I miss something?
…and sorry, if this topic does not belong to here…
Jozef
Thank you, lb90.
This is exactly what I did. It seems that the linker does not really use pkg-config --libs gtkmm-3.0, I had to include the libraries on my own. I was wondering, why only some Gtk & Cairo components are not working, like Gtk::Image and the texting option of Cairo…
How could I find out, which library to include instead of including everything? Why does e.g. cairo::line_to() work and cairo::show_text() don’t? Aren’t they in the same library?
Yes, I agree that it’s strange. You should replicate in CodeBlocks all that you get from running pkg-config --cflags --libs gtkmm-3.0 in the MSYS2 MINGW shell
It could be a linker issue on Windows. GTK definitely uses cairo_line_to(), but it most definitely doesn’t use cairo_show_text(). The symbols used by GTK may be “leaking” in the address space of your project, which means that the linker already knows how to resolve them, whereas the symbols not used by GTK need an explicit dependency.