帮小女子看看这简单的C++错在哪里?
#include <iostream>
using namespace std;
class Point {
int x , y ;
public :
void set (int a ,int b) { x = a ,y = b ;}
friend Point operator+(const Point& d ) ;
friend ostream& operator<<(ostream& o, const Point& d) ;
} ;
Point operator+(const Point &d )
{
Point s ;
s.set (x+d.x,y+d.y);
return s ;
}
ostream& operator<<(ostream& o, const Point& d) {
return o<<"("<<d.x<<", "<<d.y<<")\n" ;
}
void main()
{
Point s,t ;
s.set(2,5);
t.set(3,1);
operator+(s,t);
}
错误信息:
-------------------Configuration: training - Win32 Debug--------------------
Compiling...
training.cpp
D:\Program Files\Microsoft Visual Studio\MyProjects\myproject\training.cpp(11) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
执行 cl.exe 时出错.
training.obj - 1 error(s), 0 warning(s)