Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12289 closed Bugs (fixed)

Compile errors if you include boost/geometry/algorithms/buffer.hpp directly

Reported by: phelippeneveu@… Owned by: Barend Gehrels
Milestone: Boost 1.62.0 Component: geometry
Version: Boost 1.61.0 Severity: Regression
Keywords: cout Cc:

Description

If you include boost/geometry/algorithms/buffer.hpp directly in Boost 1.61.0, you will get compile errors about cout not being part of std. The same was ok in Boost 1.58.0. There seems to be a missing include to iostream somewhere.

Change History (3)

comment:1 by Tony Lewis <tonyelewis@…>, 6 years ago

I'm also seeing this problem with boost/geometry/algorithms/comparable_distance.hpp.

Using the latest commit (3ce8872) of the develop branch of the GitHub boostorg/geometry repo (and Boost 1.61.0 for the other libraries), both of the following commands fail:

g++     -x c++ -isystem include -isystem /opt/boost_1_61_0_gcc_build/include   include/boost/geometry/algorithms/comparable_distance.hpp
clang++ -x c++ -isystem include -isystem /opt/boost_1_61_0_clang_build/include include/boost/geometry/algorithms/comparable_distance.hpp

This violates the Boost header policy, which requires:

Make sure that a translation unit consisting of just the contents of the header file will compile successfully.

The Clang errors are:

In file included from include/boost/geometry/algorithms/comparable_distance.hpp:23:
In file included from include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp:22:
In file included from include/boost/geometry/algorithms/detail/distance/implementation.hpp:25:
In file included from include/boost/geometry/algorithms/detail/distance/multipoint_to_geometry.hpp:26:
In file included from include/boost/geometry/algorithms/detail/distance/range_to_geometry_rtree.hpp:25:
In file included from include/boost/geometry/algorithms/detail/closest_feature/range_to_range.hpp:22:
In file included from include/boost/geometry/index/rtree.hpp:30:
In file included from include/boost/geometry/algorithms/touches.hpp:32:
In file included from include/boost/geometry/algorithms/detail/overlay/overlay.hpp:27:
In file included from include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp:30:
include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp:201:10: error: no member named 'cout' in namespace 'std'
    std::cout << " TODO: merge " << cid0 << " and " << cid1 << std::endl;
    ~~~~~^
include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp:320:26: error: no member named 'cout' in namespace 'std'
                    std::cout << " CONFLICT " << std::endl;
                    ~~~~~^
2 errors generated.

comment:2 by Barend Gehrels, 6 years ago

Milestone: To Be DeterminedBoost 1.62.0
Resolution: fixed
Status: newclosed

Thanks, it is fixed - we should not std::cout unless in define-conditional blocks

comment:3 by Tony Lewis <tonyelewis@…>, 6 years ago

Yep - this works for me.

That said, I've found that other Geometry headers fail to compile independently and I've opened ticket:12393 about that.

Thanks very much for your work on this ticket.

Note: See TracTickets for help on using tickets.