无法将结构注册为增强几何体3D点

cannot register structure as boost geometry 3D point

本文关键字:增强 几何体 3D 注册 结构      更新时间:2023-10-16

这些声明无法编译

#include <boost/geometry.hpp>
namespace bg = boost::geometry;
struct c3d
{
double x, y, z;
};
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )

编译器输出:

g++.exe -Wall -fexceptions -g -m64 -IC:UsersJamescoderaven-set 
-IC:UsersJamescodeboostv1_70 -c C:UsersJamescodeTreeRobotsrctesttest.cpp 
-o objDebugTreeRobotsrctesttest.o
C:UsersJamescodeTreeRobotsrctesttest.cpp:9:67: error: 'x' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:UsersJamescodeTreeRobotsrctesttest.cpp:9:70: error: 'y' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:UsersJamescodeTreeRobotsrctesttest.cpp:9:73: error: 'z' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
   ^
C:UsersJamescodeTreeRobotsrctesttest.cpp:9:75: error: expected constructor, destructor, or type conversion at end of input
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
     ^
Process terminated with status 1 (0 minute(s), 6 second(s))
4 error(s), 0 warning(s) (0 minute(s), 6 second(s))

您需要添加#include <boost/geometry/geometries/register/point.hpp>。请参见此示例。

您缺少必要的include

#include <boost/geometry/geometries/register/point.hpp>