Re: Cairo win32 Static linking
John Emmas <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 01/02/2014 17:08, WC Black wrote: > I'm having trouble linking to cairo-static. > > I'm on windows compiling with VC. I compiled cairo myself using msys > and VC. > > I get many of these: > error LNK2019: unresolved external symbol __imp__cairo_create > error LNK2019: unresolved external symbol __imp__cairo_destroy > etc. > According to 'src/cairo.h' you need to define CAIRO_WIN32_STATIC_BUILD if you've built cairo statically. However, it looks like you'll need to define that for any library which links to cairo (i.e. rather than defining it when building cairo itself). Defining that preprocessor directive will ensure that 'cairo-public' is correctly defined for those libraries which link to cairo - BUT - What's interesting (admittedly from just a cursory glance) is that in 'src/cairoint.h', when building with MSVC, 'cairo_public' is defined as __declspec(dllexport). So when you build cairo statically it's probably just a happy accident if the library's symbols end up correct (i.e. the compiler was clever enough to realise that a static library can't have dllexported symbols). Try defining CAIRO_WIN32_STATIC_BUILD for any libraries where you're seeing those unresolved externals. You'll need to rebuild those libs but hopefully, the errors will go away. A silly question but.... why do you need cairo to be a static lib anyway? John -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo