ManWithABike / OPTICS-Clustering

An algorithm for finding density-based clusters in spatial data.
https://en.wikipedia.org/wiki/OPTICS_algorithm
MIT License
21 stars 10 forks source link

Internal Boost error during compilation #6

Closed kirilllzaitsev closed 5 months ago

kirilllzaitsev commented 5 months ago

@ManWithABike, hi, are you aware of any compilation problems for newer C++ standards? I'm trying to compile the project with C++ 17 and have the following Boost problem:

[ 80%] Building CXX object CMakeFiles/optics.dir/src/point.cpp.o
[ 85%] Building CXX object CMakeFiles/optics.dir/src/priority_queue.cpp.o
[ 90%] Building CXX object CMakeFiles/optics.dir/src/spatial_index.cpp.o
[ 95%] Building C object CMakeFiles/optics.dir/src/utils.c.o
In file included from /usr/include/boost/geometry/strategies/geographic/distance.hpp:38,
                 from /usr/include/boost/geometry/strategies/strategies.hpp:94,
                 from /usr/include/boost/geometry/geometry.hpp:57,
                 from /usr/include/boost/geometry.hpp:17,
                 from /home/user/project/include/optics/optics.hpp:20,
                 from /home/user/project/src/baseline_2.cpp:10:
/usr/include/boost/geometry/geometries/point_xy.hpp: In member function ‘void boost::geometry::model::d2::point_xy<CoordinateType, CoordinateSystem>::x(const CoordinateType&)’:
/usr/include/boost/geometry/geometries/point_xy.hpp:69:27: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Key, class _Compare, class _Alloc> class std::set’
   69 |     { this->template set<0>(v); }
      |                           ^
/usr/include/boost/geometry/geometries/point_xy.hpp:69:27: note:   expected a type, got ‘0’
/usr/include/boost/geometry/geometries/point_xy.hpp:69:27: error: template argument 2 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp:69:27: error: template argument 3 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp: In member function ‘void boost::geometry::model::d2::point_xy<CoordinateType, CoordinateSystem>::y(const CoordinateType&)’:
/usr/include/boost/geometry/geometries/point_xy.hpp:73:27: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Key, class _Compare, class _Alloc> class std::set’
   73 |     { this->template set<1>(v); }
      |                           ^
/usr/include/boost/geometry/geometries/point_xy.hpp:73:27: note:   expected a type, got ‘1’
/usr/include/boost/geometry/geometries/point_xy.hpp:73:27: error: template argument 2 is invalid
/usr/include/boost/geometry/geometries/point_xy.hpp:73:27: error: template argument 3 is invalid
In file included from /usr/include/boost/geometry/geometries/geometries.hpp:29,
                 from /usr/include/boost/geometry/algorithms/detail/closest_points/linear_or_areal_to_areal.hpp:20,
                 from /usr/include/boost/geometry/algorithms/detail/closest_points/implementation.hpp:17,
                 from /usr/include/boost/geometry/algorithms/closest_points.hpp:14,
                 from /usr/include/boost/geometry/geometry.hpp:66,
                 from /usr/include/boost/geometry.hpp:17,
                 from /home/user/project/include/optics/optics.hpp:20,
                 from /home/user/project/src/baseline_2.cpp:10:
/usr/include/boost/geometry/geometries/point_xyz.hpp: In member function ‘void boost::geometry::model::d3::point_xyz<CoordinateType, CoordinateSystem>::x(const CoordinateType&)’:
/usr/include/boost/geometry/geometries/point_xyz.hpp:68:27: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Key, class _Compare, class _Alloc> class std::set’
   68 |     { this->template set<0>(v); }

Compiling with g++ 11 and 12 gives no result. The issue is not due to the new standard, since CMakeLists.txt in this repository can compile with it as well. I don't know what to do about it and there is no resolution published on the Internet.

kirilllzaitsev commented 5 months ago

Include order matters. Resolution to the problem is to ensure that

#include "optics/optics.hpp"
#include "optics/bgr_image.hpp"

goes before other (custom) includes.