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

Started by
4 comments, last by IFooBar 20 years, 11 months ago
__int64 temp = 666; cout << temp; this produces specifed error... why and how to solve it?
Abnormal behavior of abnormal brain makes me normal...
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?

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

cout << (long)temp;

.lick
Use iostream, not iostream.h
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.
quote:Use iostream, not iostream.h


I feel that that had to be repeated.

:::: [ Triple Buffer V2.0 ] ::::
[size=2]aliak.net

This topic is closed to new replies.

Advertisement