• ### Announcements

#### Archived

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

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

## Recommended Posts

__int64 temp = 666; cout << temp; this produces specifed error... why and how to solve it?

##### Share on other sites
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 on other sites
cout << (long)temp;

.lick

##### Share on other sites
Use iostream, not iostream.h

##### 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 on other sites
quote:
Use iostream, not iostream.h

I feel that that had to be repeated.

:::: [ Triple Buffer V2.0 ] ::::

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627654
• Total Posts
2978443

• 10
• 12
• 22
• 13
• 33