Search code examples
c++cvisual-studiogtkcairo

Unresolved external symbol : __cairo_path_fixed_stroke_to_traps


I was following this post to build and install cairo.

However, I got stuck with the below error :

Error   277 error LNK2019: unresolved external symbol __cairo_path_fixed_stroke_to_traps referenced in function __cairo_traps_compositor_stroke C:\gtk_compilation\cairo\cairo-1.12.18\msvc\vs10\cairo-traps-compositor.obj cairo

The installation guide says I need to turn off the whole programme optimization which I did using the the /GL- compiler flag but still there is no way around the issue.

Below is an excerpt from the C:\gtk_compilation\cairo\cairo-1.12.18\msvc\vs10\cairo-traps-compositor.c file :

cairo_int_status_t (*func) (const cairo_path_fixed_t    *path,
                const cairo_stroke_style_t  *stroke_style,
                const cairo_matrix_t    *ctm,
                const cairo_matrix_t    *ctm_inverse,
                double           tolerance,
                cairo_traps_t       *traps);
composite_traps_info_t info;
unsigned flags;

if (antialias == CAIRO_ANTIALIAS_BEST || antialias == CAIRO_ANTIALIAS_GOOD) {
        func = _cairo_path_fixed_stroke_polygon_to_traps;
        flags = 0;
    } else {
        func = _cairo_path_fixed_stroke_to_traps; /* line#2183 */
        flags = need_bounded_clip (extents) & ~NEED_CLIP_SURFACE;
    }

The above functions are defined in cairoint.h as :

cairo_private cairo_int_status_t
_cairo_path_fixed_stroke_to_traps (const cairo_path_fixed_t *path,
                   const cairo_stroke_style_t   *stroke_style,
                   const cairo_matrix_t *ctm,
                   const cairo_matrix_t *ctm_inverse,
                   double        tolerance,
                   cairo_traps_t    *traps);

cairo_private cairo_int_status_t
_cairo_path_fixed_stroke_polygon_to_traps (const cairo_path_fixed_t *path,
                       const cairo_stroke_style_t   *stroke_style,
                       const cairo_matrix_t *ctm,
                       const cairo_matrix_t *ctm_inverse,
                       double        tolerance,
                       cairo_traps_t    *traps);

Could anybody please suggest a workaround for this?


Solution

  • Following @andlabs comment, I found out that the file cairo-path-stroke-traps.c was not included in the Visual Studio project sources. Added this one and rebuilt the solution - Voila !!