无法将结构注册为增强几何 3D 点
cannot register structure as boost geometry 3D point
这些声明编译失败
#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:\Users\James\code\raven-set
-IC:\Users\James\code\boost\v1_70 -c C:\Users\James\code\TreeRobot\src\testtest.cpp
-o obj\Debug\TreeRobot\src\testtest.o
C:\Users\James\code\TreeRobot\src\testtest.cpp:9:67: error: 'x' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:\Users\James\code\TreeRobot\src\testtest.cpp:9:70: error: 'y' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:\Users\James\code\TreeRobot\src\testtest.cpp:9:73: error: 'z' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:\Users\James\code\TreeRobot\src\testtest.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 <boost/geometry/geometries/register/point.hpp>
。参见 this example。
这些声明编译失败
#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:\Users\James\code\raven-set
-IC:\Users\James\code\boost\v1_70 -c C:\Users\James\code\TreeRobot\src\testtest.cpp
-o obj\Debug\TreeRobot\src\testtest.o
C:\Users\James\code\TreeRobot\src\testtest.cpp:9:67: error: 'x' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:\Users\James\code\TreeRobot\src\testtest.cpp:9:70: error: 'y' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:\Users\James\code\TreeRobot\src\testtest.cpp:9:73: error: 'z' has not been declared
BOOST_GEOMETRY_REGISTER_POINT_3D( c3d, double, bg::cs::cartesian, x, y, z )
^
C:\Users\James\code\TreeRobot\src\testtest.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 <boost/geometry/geometries/register/point.hpp>
。参见 this example。