Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:24:20+00:00 2026-06-15T20:24:20+00:00

I just write a simply example given by boost ( http://www.boost.org/doc/libs/1_52_0/libs/geometry/doc/html/geometry/quickstart.html ). There are

  • 0

I just write a simply example given by boost (http://www.boost.org/doc/libs/1_52_0/libs/geometry/doc/html/geometry/quickstart.html). There are some errors during compiling. I use eclipse and Mingw to compile it. Could someone tell me what’s the problem?

The test code is as follows:

#include <iostream>
using namespace std;

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/algorithms/distance.hpp>

using namespace boost::geometry;

int main() {
cout << "!!!Hello World!!!" << endl; 
model::d2::point_xy<int> p1(1, 1), p2(2, 2);
cout << "Distance p1-p2 is: " << distance(p1, p2) << endl;
return 0;
}

The error is as follows:

c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-  
mingw32/4.7.1/include/c++/bits/stl_iterator_base_funcs.h:114:5:   
required by substitution of 'template<class _InputIterator> 
typename std::iterator_traits::difference_type 
std::distance(_InputIterator, _InputIterator) [with _InputIterator 
= boost::geometry::model::d2::point_xy<int>]'
..\src\test.cpp:22:50:   required from here
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-  
mingw32/4.7.1/include/c++/bits/stl_iterator_base_types.h:166:53: 
error: no type named 'iterator_category' in 'class 
boost::geometry::model::d2::point_xy<int>'
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-
mingw32/4.7.1/include/c++/bits/stl_iterator_base_types.h:167:53: 
error: no type named 'value_type' in 'class   
boost::geometry::model::d2::point_xy<int>'
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64- 
mingw32/4.7.1/include/c++/bits/stl_iterator_base_types.h:168:53: 
error: no type named 'difference_type' in 'class  
boost::geometry::model::d2::point_xy<int>'
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64- 
mingw32/4.7.1/include/c++/bits/stl_iterator_base_types.h:169:53: 
error: no type named 'pointer' in 'class 
boost::geometry::model::d2::point_xy<int>'
c:\program files\mingw64\bin\../lib/gcc/x86_64-w64-  
mingw32/4.7.1/include/c++/bits/stl_iterator_base_types.h:170:53: 
error: no type named 'reference' in 'class 
boost::geometry::model::d2::point_xy<int>'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:24:21+00:00Added an answer on June 15, 2026 at 8:24 pm

    This is why you should be sparing with using-directives. You have:

    using namespace std;
    using namespace boost::geometry;
    

    dragging all the names within these namespaces into the global namespace. That includes both std::distance and boost::geometry::distance and (judging from the error message) std::distance was chosen as the better overload.

    If you remove using namespace std;, and qualify with std:: where necessary, then all should be fine. Alternatively, if you really want to keep the namespace pollution, then write the qualified name, boost::geometry::distance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just write an simple example to test boost::bind. I use it to instantiate
how can I write just a simple disassembler for linux from scratches? Are there
How do you guys write comments on some simple code that you use just
I have a macro to write, quite simple. It just pulls numeric values from
WiX is great in that there is no GUI, you just write the installer
i am writing javascript code on nodepad++,i am at beginner level and write just
Just wanted to write some recursion but can't check if the child is in
Just trying to write my first ever WP7 app. I have several hundreds of
I have urls of the following format (I write it as as aregex): http://exampledomain\.com/files/.+
Okay so I'm just trying to write some simple code that updates a record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.