Bug report #4507
GEOS spatialindex.h conflicts with SpatialIndex.h
|Affected QGIS version:||Regression?:||No|
|Operating System:||OS X||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||14430|
When compiling qgsspatialindex.cpp, the there are a lot of parsing errors after the SpatialIndex namespace declaration.
The compile command has the GEOS include path before the SpatialIndex include path, and GEOS has a "spatialindex.h" (all lowercase). If the SpatialIndex include path is before GEOS, it finds the correct SpatialIndex.h (caps/lowercase) and compiles.
I couldn't find any definite info on whether the precompilation is supposed to be case sensitive or not, but it appears to be dependent on the file system. If so, HFS+ is case-aware, but not case-sensitive.
The solution appears to be to just move the SpatialIndex include path to before GEOS. GEOS uses subfolder include setup (ie #include <geos/spatialindex.h>) so this shouldn't interfere with GEOS includes.
#1 Updated by William Kyngesburye almost 10 years ago
- Resolution set to fixed
Ah, the OS X framework has geos_c.h along with the C++ headers. This is so that the framework include method works for C++ headers (OS X framework headers can be specified with the framework name/header without -I flags, say <GEOS/spatialindex.h>, and the compiler knows to look in the framework's headers folder, ie GEOS.framework/Headers/spatialindex.h), and so the C header also has a place to be (there are no other header folders in a framework and a subfolder for the C++ headers would break the framework include method. IOW, the C++ headers can't be isolated like they are on other systems.
Putting the SpatialIndex include path before GEOS is then an acceptable solution. Applied in b9d26e4 (thanks Juergen).