Jump to content
  • Advertisement
Sign in to follow this  
Hermes

operator ' is ambiguous

This topic is 5466 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

Hi ,any time i try using cout<< unsigned __int64value i get an operator << is ambigous. A solution would be to use printf but this is so so C like. Any ideas? [smile]

Share this post


Link to post
Share on other sites
Advertisement
Were you actually literally trying some statement like "cout << unsigned __int64 value;", or do you mean

unsigned __int64 value;
cout << value;

?

The first won't work. At all. The second will work if your compiler is not lame. If it doesn't work, your compiler is lame. [wink]

Share this post


Link to post
Share on other sites
Quote:
Original post by Doc
The second will work if your compiler is not lame. If it doesn't work, your compiler is lame. [wink]
Or you are using the wrong header.

Share this post


Link to post
Share on other sites
unsigned __int64 isn't a standard C++ type, therefore your compiler's headers probably do not overload << for it to work with the ostream templates. No, this doesn't mean your compiler is bad -- it's perfectly fine. You get ambiguity because an unsigned __int64 can be converted to a standard C++ type that does have an overloaded <<. For instance, usigned __int64 can be probably be implicitly converted to either an unsigned long or an unsigned int or an unsigned short or an unsigned char, all of which have an associated operator << overloaded to work with the ostream templates so it's ambiguous as to which one it should convert to. So, either overload << for unsigned __int64 to work with ostream or explicitly typecast your value to a standard C++ type which has an overloaded << to work with ostream.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!