//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);Â
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-
win32-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-
win32-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(
libpangowin32-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(
libpangowin32-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(
libpangocairo-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(
libpangocairo-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_
pixbuf-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_
pixbuf-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.
dll) : 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.
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>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.
Â