c++ - 无法将结构注册为增强几何3D点

标签 c++ boost-geometry

这些声明无法编译

#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>。参见this example

关于c++ - 无法将结构注册为增强几何3D点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62904464/

相关文章:

c++ - 关于 Protocol Buffer 事件的设计问题

c++ - 无法从主窗口打开小部件

c++ - 错误 C2678 : binary '==' : no operator found which takes a left-hand operand of type (or there is no acceptable conversion)

c++ - strcmp() 可以比较动态字符数组和静态字符数组吗?

c++ - 如何让你的程序重复递增,直到在 switch 语句中按下另一个键

c++ - 为什么我可以使用模板函数作为 std::sort 的参数,但不能使用模板 lambda(使用成员函数 ptr 作为模板参数)

c++ - 将 boost::geometry 多边形转换为 STL 对象

c++ - boost::rtree 受 gcc 编译器的影响很大

c++ - 提升几何圆段相交