Problems compiling xmsinterp using Boost Geometry

Viewed 24

I am using Microsoft Visual Studio Community Edition 2022. I am trying to compile and use the xmsinterp library. This code has introduced me to Boost. I was able to compile the codes and get answers until I started including the Delauney Triangulation codes, which rely on the Boost geometry modules. I have included the following headers in my program.

//  Boost Codes

#include <boost/bind/bind.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/unordered_set.hpp>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
//#include <boost/geometry/strategies/default_strategy.hpp>
//#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/index/rtree.hpp>

using namespace boost::geometry;

#include <boost/unordered_map.hpp>
#include <boost/iterator/counting_iterator.hpp>

//  xmscore codes...

#include <xmscore/math/math.h>
#include <xmscore/stl/utility.h>
#include <xmscore/xmscore/points/ptsfwd.h>
//#include <xmsgrid/geometry/GmBoostTypes.h>
#include <xmsgrid/geometry/geoms.h>
#include <xmsgrid/geometry/GmPtSearch.h>
#include <xmscore/misc/xmstype.h>
#include <xmscore/misc/XmError.h>
#include <xmscore/misc/XmConst.h>

//  xmsgrid codes...

#include <xmsgrid/geometry/GmBoostTypes.h>
#include <xmsgrid/geometry/GmTriSearch.h>

//  xmsinterp codes...

#include <new.h>
#include <xmscore/misc/xmstype.h>
#include <xmsinterp/interpolate/detail/InterpCt.h>
#include <xmscore/stl/vector.h>
#include <xmsinterp/interpolate/detail/InterpCt.cpp>
#include <xmsinterp/interpolate/detail/NodalFunc.cpp>

//  xmsinterp test cases...
#include <xmsinterp/interpolate/InterpIdw.h>
#include <xmsinterp/interpolate/InterpLinear.h>
#include <xmsinterp/interpolate/InterpAnisotropic.h>
#include <xmsgrid/triangulate/TrTriangulator.h>

#include <xmsgrid/triangulate/TrTriangulatorPoints.h>
#include <xmsgrid/triangulate/detail/triangulate.h>

I get the following error messages, which all refer to the Boost Geometry modules. I removed the prefixes on the directory names to hopefully reduce clutter.

.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(90,10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(90,20): error C2059: syntax error: 'constant'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(91,59): error C2065: 'PG': undeclared identifier
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(91,47): error C2974: 'boost::geometry::strategy::centroid::average': invalid template argument for 'Ignored1', type expected
.\boost\libs\geometry\include\boost\geometry\strategies\cartesian\centroid_average.hpp(51): message : see declaration of 'boost::geometry::strategy::centroid::average'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(91,47): error C2923: 'boost::geometry::strategy::centroid::average': 'PG' is not a valid template type argument for parameter 'Ignored2'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(91): message : see declaration of 'PG'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(91,47): error C3203: 'average': unspecialized class template can't be used as a template argument for template parameter 'Strategy', expected a real type
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(92,1): error C2906: 'boost::geometry::strategies::centroid::services::strategy_converter<int>': explicit specialization requires 'template <>'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(99,10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(99,20): error C2059: syntax error: 'constant'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(100,67): error C2065: 'PG': undeclared identifier
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(100,47): error C2974: 'boost::geometry::strategy::centroid::weighted_length': invalid template argument for 'Ignored1', type expected
.\boost\libs\geometry\include\boost\geometry\strategies\cartesian\centroid_weighted_length.hpp(49): message : see declaration of 'boost::geometry::strategy::centroid::weighted_length'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(100,47): error C2923: 'boost::geometry::strategy::centroid::weighted_length': 'PG' is not a valid template type argument for parameter 'Ignored2'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(100): message : see declaration of 'PG'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(100,47): error C2976: 'boost::geometry::strategy::centroid::weighted_length': too few template arguments
.\boost\libs\geometry\include\boost\geometry\strategies\cartesian\centroid_weighted_length.hpp(49): message : see declaration of 'boost::geometry::strategy::centroid::weighted_length'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(100,47): error C3203: 'weighted_length': unspecialized class template can't be used as a template argument for template parameter 'Strategy', expected a real type
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(101,1): error C2906: 'boost::geometry::strategies::centroid::services::strategy_converter<int>': explicit specialization requires 'template <>'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(108,10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(108,20): error C2059: syntax error: 'constant'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109,66): error C2065: 'PG': undeclared identifier
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109,70): error C2065: 'CT': undeclared identifier
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109,47): error C2974: 'boost::geometry::strategy::centroid::bashein_detmer': invalid template argument for 'Ignored1', type expected
.\boost\libs\geometry\include\boost\geometry\strategies\cartesian\centroid_bashein_detmer.hpp(126): message : see declaration of 'boost::geometry::strategy::centroid::bashein_detmer'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109,47): error C2923: 'boost::geometry::strategy::centroid::bashein_detmer': 'PG' is not a valid template type argument for parameter 'Ignored2'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109): message : see declaration of 'PG'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109,47): error C2923: 'boost::geometry::strategy::centroid::bashein_detmer': 'CT' is not a valid template type argument for parameter 'CalculationType'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109): message : see declaration of 'CT'
.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(109,47): error C3203: 'bashein_detmer': unspecialized class template can't be used as a template argument for template parameter 'Strategy', expected a real type

.\boost\libs\geometry\include\boost\geometry\strategies\centroid\cartesian.hpp(110,1): error C2906: 'boost::geometry::strategies::centroid::services::strategy_converter<int>': explicit specialization requires 'template <>'

Any suggestions would be helpful.

TIA

1 Answers

I was able to solve this problem and compile the program.

I stripped my main program down to the function that was giving me problems, deleted all of the header files, and started adding them back until I was able to resolve all of the variables. I still had build errors. Along the way, I saw a suggestion to add the following variable _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH to the pre-processor. This allowed the stripped-down program to compile.

I then reverted back to the main program, removed all of the header files and replaced them with the ones from the test program. This worked!

Here are the updated header files:

//  Boost Codes

#include <vector>
#include <xmscore/stl/vector.h>
#include <xmscore/points/ptsfwd.h>
#include <xmscore/misc/base_macros.h>
#include <xmscore/misc/boost_defines.h>
#include <xmscore/misc/Observer.h>
#include <xmscore/misc/XmError.h>


// 2. My own header
#include <xmsgrid/triangulate/TrTriangulatorPoints.h>

// 3. Standard library headers

// 4. External library headers

// 5. Shared code headers

#include <xmsgrid/geometry/geoms.h>

#include <xmsgrid/geometry/GmPtSearch.h>
#include <xmsgrid/geometry/GmTriSearch.h>

#include <xmsgrid/triangulate/triangles.h>
#include <xmsgrid/triangulate/TrTriangulatorPoints.t.h>
#include <xmsgrid/triangulate/detail/triangulate.h>

//#include <xmscore/testing/TestTools.h>

#include <xmsinterp/tutorial/TutInterpolation.t.h>

#include <xmsinterp/interpolate/detail/NodalFunc.h>
#include <xmsinterp/interpolate/detail/InterpNatNeigh.h>
#include <xmsinterp/interpolate/detail/InterpCt.h>
#include <xmsinterp/interpolate/InterpIdw.h>
#include <xmsinterp/interpolate/InterpLinear.h>
#include <xmsinterp/interpolate/InterpAnisotropic.h>


using namespace xms;
Related