Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

original vesoljc

__int64 & error C2593: 'operator <<' is ambiguous

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

Advertisement
cout doesn''t have a << operator defined for 64 bit ints. There''s your why


As to solving it, I''m not sure. I''ve only used __int64s with *printf so I can''t say how to work around it with cout. I''m very evil with my C/C++ programming and often mix C-style functions with C++ code just to get around issues like this. That''s my best offer; maybe someone else knows a better way?

Share this post


Link to post
Share on other sites
I use unsigned __int64 a great deal in my programs, and the only way I know of to print the value is to use printf() (unless you want to write your own, which isn''t difficult, but might as well use printf then...).

unsigned __int64 i = Some64BitValue();
printf("%I64u\n", i);

In VC++ you add I64 to printf, as shown above. For instance:

%d becomes %I64d
%u becomes %I64u
%x becomes %I64x

and so on...

I think gcc and maybe the Intel compiler use %ll instead of %I64. So you would do %llu instead of %I64u, etc. You can write some #define''s to handle this so your code will compile in VC++ and gcc if that is needed.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!