I can't seem to understand whats wrong with my program. I keep getting this linker error.
Code:
error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator
<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class Bid_Class &)" (??6@YAAAV?$basic_ostream@DU?$ch
ar_traits@D@std@@@std@@AAV01@AAVBid_Class@@@Z) referenced in function "class std::basic_ostream<char,struct std::ch
ar_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,
class Item_Class const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVItem_Class@@@Z)
Code:
//Private
Bid_Class *bidPointer;
//Public
Bid_Class * getPointer() const { return bidPointer;}
ostream& operator<< (ostream &out,const Item_Class& obj)
{
Bid_Class *tempPointer=obj.getPointer();
out<<obj.getName()<<" ("<<obj.getID()<<")"<<endl;
if(obj.getBids()==0)
{
out<<" *** No Current Bids ***"<<endl;
}
else
{
for(int i=0;i<obj.getBids();i++)
{
///////////////////////////////////////////////////////////////////////////////////////////////////
out<<tempPointer[i];//This is the part that is giving me the linking errors
//////////////////////////////////////////////////////////////////////////////////////////////////
}
}
return out;
}
//The operator that's being called.
ostream& operator<<(ostream &out, const Bid_Class& obj)
{
out<<" --- "<<obj.bidDate.getMonth()<<'/'<<obj.bidDate.getDay()<<'/'<<obj.bidDate.getYear()<<' '<<obj.biddersName<<' '<<obj.amount;
return out;
}
This should work, but I keep getting some errors. Can anyone help?