[geos-devel] GEOSVoronoiDiagram missing symbol

Joshua Arnott josh at snorfalorpagus.net
Fri Aug 29 06:53:42 PDT 2014


Hello,

I want to use the voronoi diagram functionality from the C API. The linker is complaining about the GEOSVoronoiDiagram not being found.

I’ve written the following simple program:

#include <stdio.h>
#include <stdlib.h>

#include "geos_c.h"

int
main(int argc, char **argv) {
    initGEOS(NULL, NULL);
    GEOSGeometry* g1;
    GEOSGeometry* g2;
    char* wkt = "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))";
    g1 = GEOSGeomFromWKT(wkt);
    g2 = GEOSVoronoiDiagram(g1, NULL, 0.0, 0);
    printf("%s\n", GEOSGeomToWKT(g1));
    finishGEOS();
    return 0;
}

The compiler raises the following error:

$ cc -o voronoi voronoi.c -lgeos_c
voronoi.c:13:10: warning: implicit declaration of function 'GEOSVoronoiDiagram' is
      invalid in C99 [-Wimplicit-function-declaration]
    g2 = GEOSVoronoiDiagram(g1, NULL, 0.0, 0);
         ^
voronoi.c:13:8: warning: incompatible integer to pointer conversion assigning to
      'GEOSGeometry *' (aka 'struct GEOSGeom_t *') from 'int' [-Wint-conversion]
    g2 = GEOSVoronoiDiagram(g1, NULL, 0.0, 0);
       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
Undefined symbols for architecture x86_64:
  "_GEOSVoronoiDiagram", referenced from:
      _main in voronoi-41964a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Removing the call to GEOSVoronoiDiagram allows the program to compile and run without error.

Using `nm` I’ve checked, and the function appears to be missing from the shared library. The related GEOSDelaunayTriangulation is present. The version of GEOS I’ve compiled does appear to include the function so I’m not sure what’s going wrong.

Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20140829/877224d5/attachment.html>


More information about the geos-devel mailing list