Я прогнал у себя наподобие твоего кода
#include <iostream.h>
struct Point
{
int x;
int y;
Point() {x=0; y=0;}
};
class Prob
{
friend ostream &operator <<(ostream &, const Prob &);
public:
Prob();
void setPoint(Point pt);
void setPoint(int x, int y);
~Prob();
protected:
Point pt;
};
ostream &operator <<(ostream & output, const Prob & pr)
{
output << "X= " << pr.pt.x <<" Y=" << pr.pt.y <<" ";
return output;
}
void Prob::setPoint(Point pt)
{
this->pt.x=pt.x;
this->pt.y=pt.y;
}
void Prob::setPoint(int x, int y)
{
pt.x=x;
pt.y=y;
}
Prob::~Prob()
{
}
Prob::Prob()
{
}
int main()
{
Prob prob;
prob.setPoint(10,20);
cout << prob<< endl;
return 0;
}
У меня все компилируется и работает нормально. Так что скорее всего проблемы в настройке самого компилятора и линкера. Какая версия кстати?
P.s. Заглянул сюда
http://support.microsoft.com/kb/168440И получил
You may receive an "error C2593: 'operator <<' is ambiguous" error message when you try to pass an __int64 variable to the ostream operator <<
Признавайся
Используеш ли int64?