Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/137.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ c++;11和助推几何_C++_C++11_Boost_Boost Geometry - Fatal编程技术网

C++ c++;11和助推几何

C++ c++;11和助推几何,c++,c++11,boost,boost-geometry,C++,C++11,Boost,Boost Geometry,我开始学习c++11,并尝试使用boost geometry运行一些示例代码 #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/geometries/adapted/boost_tuple.hpp> BOOST_GEOMETRY_REGISTER_B

我开始学习c++11,并尝试使用boost geometry运行一些示例代码

#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>

BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)


int main()
{
    typedef boost::tuple<double, double> point;
    typedef boost::geometry::model::polygon<point> polygon;

    polygon poly;
    boost::geometry::read_wkt("polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
        ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))", poly);

    polygon hull;
    boost::geometry::convex_hull(poly, hull);

    using boost::geometry::dsv;
    std::cout
        << "polygon: " << dsv(poly) << std::endl
        << "hull: " << dsv(hull) << std::endl
        ;


    return 0;
}
常数Polygon2&,常数策略&~: 增强/包含/增强/几何/算法/细节/重新计算。hpp:145:24: 费勒:未定义“it_源”

boost/include/boost/geometry/algorithms/detail/recalculate.hpp:146:24: Fehler: »it_dest« is not defined
有人知道为什么这不起作用吗

Sry我忘了添加我的系统。我在GCC4.6.3和Boost1.55中使用64位Mint13


感谢您的帮助

显然是您的编译器

  • C++11是否面临挑战
  • 配置错误
在这种情况下,
BOOST\u AUTO\u TPL
不起作用:

    BOOST_AUTO_TPL(it_source, boost::begin(rings_source));
    BOOST_AUTO_TPL(it_dest, boost::begin(rings_dest));
在c++11编译器上,它将扩展为

auto it_source = boost::begin(rings_source);
auto it_dest = boost::begin(rings_dest);

但是,如果您在c++03模式下编译它(例如,在gcc/clang上没有
-std=c++11
),您可能会得到一个错误,即
it\u source
it\u dest
不是有效的类型(此外,其余语句/声明格式不正确)

它对我来说是有效的:boost 1.54,gcc 4.7.2在询问错误时总是这样(编译或链接或其他),编写、编译器(包括版本,如果使用非默认库,则包括名称)以及发生错误时的平台(例如:GCC 4.9.0 32位、Windows 8.1或GCC 4.9.0 32位,带libc++、Windows 8.1等)我建议先更新。4.6.3真的很旧。好的,用ppa更新gcc 4.8是有用的。或者我应该使用ubuntu软件包系统中的gcc 4.7吗?谢谢你的帮助。我应该如何定义我的编译器?我只做gcc-std=c++0x main.cpp-I~/boost/include。没有boost几何体,我可以使用c++11的功能,如auto@Hunk照常在编译时完成所有操作,“自动”。但是,检测例程可能在您的平台上出错。您可以查看Boost 1.55支持的编译器版本,或者尝试将您的工具chian.hi i将gcc更新为4.9.1并出现相同的错误。您有什么想法吗?因为标志i使用gcc-std=c++11或-std=c++0x是相同的还是相同的?
auto it_source = boost::begin(rings_source);
auto it_dest = boost::begin(rings_dest);