Thanks fanc,I've moved the library dependencies from the static library's VS project config to the exe's, and the linker errors have now gone.However, the exe's Cairo backend contexts are still not rendering to their surfaces. All post-rendering surface to image calls are outputting blank PNGs.e.g.//basic testcairo_surface_t *surface;cairo_t *cr;surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 390, 60); cr = cairo_create(surface);cairo_set_source_rgb(cr, 0, 0, 0);cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);cairo_set_font_size(cr, 40.0);cairo_move_to(cr, 10.0, 50.0);cairo_show_text(cr, "Test");cairo_surface_write_to_png(surface, "f:\\cairo_test_basic.png"); cairo_destroy(cr);cairo_surface_destroy(surface); This code frag generates a PNG with transparent background and black text, "Test", in my example project, but just a transparent PNG in my main project.On 25 January 2017 at 03:49, <fanc999 yahoo com tw> wrote:Hi Jeff,
Don’t add anything to the additional dependencies for your static lib. You only need them for your dll’s and exe’s. This should avoid the warnings.
Hope this helps.
With blessings, and cheers!
從 Windows 10 手機傳送
寄件者: Jeffrey Sheen
傳送時間: 2017年1月25日 01:43
收件者: gtk-list gnome org
主旨: Windows GTK+ 2.24.10: Cairo contexts not rendering to surface
Dear list,
I have raised an issue on the Cairo mailing list, who have referred me here. Your advice would be greatly appreciated.
I'm trying to incorporate Pango-Cairo rendering into a cross-platform project. Windows XP is a target platform for the project, so I am building against the GTK+ 2.24.10 Bundle (20120208). N.B. This is a C/C++ implementation.
The problem I'm having is that no Cairo backend contexts are rendering pixels to their surfaces in my main project's EXE, but are working as expected in a small demo project's EXE.
I followed this guide to setting up my VS 2015 projects: http://stackoverflow
.com/questions/15906580/how- to-configure-gtk-on-visual- studio-2010
The significant difference between the structure of the functioning demo project and the main project is that the main project's EXE does not call the GTK+ API directly, but is dependent on a custom static library that is built against the GTK+ libs/dlls.
i.e. GTK+ 2 API calls are made in the functions of the custom static library, whose functions are called in-turn by the main project's EXE.
When building the static library, I receive the following linker warnings that do not appear when building the demo EXE:
1>gdk-win32-2.0.lib(libgdk-win
32-2.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>gdk-win32-2.0.lib(libgdk-win
32-2.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>atk-1.0.lib(libatk-1.0-0.dll
) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>atk-1.0.lib(libatk-1.0-0.dll
) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>gio-2.0.lib(libgio-2.0-0.dll
) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>gio-2.0.lib(libgio-2.0-0.dll
) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>pangowin32-1.0.lib(libpangow
in32-1.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>pangowin32-1.0.lib(libpangow
in32-1.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>gdi32.lib(GDI32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32
-2.0-0.dll); second definition ignored 1>gdi32.lib(GDI32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>pangocairo-1.0.lib(libpangoc
airo-1.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>pangocairo-1.0.lib(libpangoc
airo-1.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>gdk_pixbuf-2.0.lib(libgdk_pi
xbuf-2.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>gdk_pixbuf-2.0.lib(libgdk_pi
xbuf-2.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>pango-1.0.lib(libpango-1.0-0
.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>pango-1.0.lib(libpango-1.0-0
.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>cairo.lib(libcairo-2.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32
-2.0-0.dll); second definition ignored 1>cairo.lib(libcairo-2.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>gobject-2.0.lib(libgobject-2
.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>gobject-2.0.lib(libgobject-2
.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>gmodule-2.0.lib(libgmodule-2
.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>gmodule-2.0.lib(libgmodule-2
.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>gthread-2.0.lib(libgthread-2
.0-0.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>gthread-2.0.lib(libgthread-2
.0-0.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>glib-2.0.lib(libglib-2.0-0.d
ll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32 -2.0-0.dll); second definition ignored 1>glib-2.0.lib(libglib-2.0-0.d
ll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library 1>intl.lib(intl.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in gtk-win32-2.0.lib(libgtk-win32
-2.0-0.dll); second definition ignored 1>intl.lib(intl.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
I know that the GTK+ bundle I have is functional, due to the success of the demo project, but would appreciate help configuring my main project.