g*******s 发帖数: 59 | 1 friend ostream & operator <<(ostream &output, const Complex &rhs)
{
output<<"("<
return output;
}
can compile and run well;
however if inside class define
friend ostream & operator <<(ostream &output, const Complex &rhs);
outside class
template
ostream & operator <<(ostream &output, const Complex &rhs)
{
output<<"("<
return output;
}
ERROR:
main.obj : error LNK2019: unresolved external symbol | P********e 发帖数: 2610 | 2 put that outside definition of operator << in .h file
【在 g*******s 的大作中提到】 : friend ostream & operator <<(ostream &output, const Complex &rhs) : { : output<<"("<: return output; : } : can compile and run well; : however if inside class define : friend ostream & operator <<(ostream &output, const Complex &rhs); : outside class : template
|
|