Jump to content
  • Advertisement
Sign in to follow this  
spacekid434

Error C2593

This topic is 2553 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys.

I am doing the last program in beginning c++ though game programming and i have come across a compile error (in title). D=

The error is "error C2593: 'operator <<' is ambiguous"

here is the function that the error is in. I hope this enough to help but if its not i will most more later. This is a friend function to a class (GenericPlayer)
ostream& operator<<(ostream& os, const GenericPlayer& aGenericPlayer){
os << aGenericPlayer.m_Name << ":\t";

vector<Card*>::const_iterator pCard;
if(!aGenericPlayer.m_Cards.empty()){
for(pCard = aGenericPlayer.m_Cards.begin(); pCard != aGenericPlayer.m_Cards.end(); ++pCard){
os << *(*pCard) << "\t"; // this is the line of code with the error. It is the first << operator
}
if(aGenericPlayer.GetTotal() != 0){
cout << "(" << aGenericPlayer.GetTotal() << ")";
}
}
else{
os << "<empty>";
}
return os;
}



Thanks for the help
spacekid434

Share this post


Link to post
Share on other sites
Advertisement
Does the error message list the possible interpretations of operator<< that create ambiguity?

Share this post


Link to post
Share on other sites
Sounds like you forgot to write an overload of << for the Card class/struct, or maybe accidentally made a mistake in its definition.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!