devc++编译后再stl_iterator_base_types中报错

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
#include <iostream>
#include <cmath>
using namespace std;
class location{
 private:
  int x,y;
 public:
  location(int a,int b)
  {
   x=a;y=b;
  }
  friend void D(location &a,location &b);
  void diatance(location &m,location &n)
  {
   float d1;
   d1=sqrt((m.x-n.x)*(m.x-n.x)+((m.y-n.y)*(m.y-n.y)));
   cout<<"A("<<m.x<<','<<m.y<<"),"<<"B("<<n.x<<','<<n.y<<")"<<endl<<"Distance1="<<d1<<endl;
  }

};
void D(location &a,location &b)
{
 float d2;
 d2=sqrt((a.x-b.x)*(a.x-b.x)+((a.y-b.y)*(a.y-b.y)));
 cout<<"Distance2="<<d2;
}
int main()
{
 location A(-3,-1);
 location B(-3,2);
 distance(A,B);
 D(A,B);
 return 0;
}

换VS2010Express再试试
Visual C++ 2010 Express简体中文版 http://pan.baidu.com/s/1bnwRVLt