<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>I want to use the voronoi diagram functionality from the C API. The linker is complaining about the GEOSVoronoiDiagram not being found.</div><div><br></div><div>I’ve written the following simple program:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">#include <stdio.h></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">#include <stdlib.h></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">#include "geos_c.h"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">int</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">main(int argc, char **argv) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    initGEOS(NULL, NULL);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    GEOSGeometry* g1;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    GEOSGeometry* g2;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    char* wkt = "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))";</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    g1 = GEOSGeomFromWKT(wkt);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    g2 = GEOSVoronoiDiagram(g1, NULL, 0.0, 0);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    printf("%s\n", GEOSGeomToWKT(g1));</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    finishGEOS();</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    return 0;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">}</div></div><div><br></div><div>The compiler raises the following error:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">$ cc -o voronoi voronoi.c -lgeos_c</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b>voronoi.c:13:10: </b><span style="color: rgb(213, 59, 211);"><b>warning: </b></span><b>implicit declaration of function 'GEOSVoronoiDiagram' is</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b>      invalid in C99 [-Wimplicit-function-declaration]</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    g2 = GEOSVoronoiDiagram(g1, NULL, 0.0, 0);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(52, 189, 38);"><b>         ^</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b>voronoi.c:13:8: </b><span style="color: rgb(213, 59, 211);"><b>warning: </b></span><b>incompatible integer to pointer conversion assigning to</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b>      'GEOSGeometry *' (aka 'struct GEOSGeom_t *') from 'int' [-Wint-conversion]</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    g2 = GEOSVoronoiDiagram(g1, NULL, 0.0, 0);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(52, 189, 38);"><b>       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2 warnings generated.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Undefined symbols for architecture x86_64:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  "_GEOSVoronoiDiagram", referenced from:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">      _main in voronoi-41964a.o</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">ld: symbol(s) not found for architecture x86_64</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">clang: error: linker command failed with exit code 1 (use -v to see invocation)</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: Helvetica; font-size: 12px;">Removing the call to GEOSVoronoiDiagram allows the program to compile and run without error.</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: Helvetica; font-size: 12px;"><br></span></div><div style="margin: 0px;">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.</div><div style="margin: 0px;"><br></div><div style="margin: 0px;">Josh</div></body></html>