__int64

Mihai Donțu mihai.dontu@gmail.com
Mon Sep 28 22:33:00 GMT 2009


On Tuesday 29 September 2009 01:24:56 Steve Adams wrote:
> I've sent someone C source code for a simple routine that
> compiles fine with Microsoft's Visual C++, but when they
> try to compile it with gcc they get the errors:
> 
> -bash-3.2$ g++ nkg.cpp
> nkg.cpp: In function âint main(int, char**)â:
> nkg.cpp:83: error: â__int64â does not name a type
> nkg.cpp:84: error: â__int64â does not name a type
> nkg.cpp:89: error: âserNumâ was not declared in this scope
> nkg.cpp:96: error: âserNumâ was not declared in this scope
> nkg.cpp:141: error: âlicenseâ was not declared in this scope
> nkg.cpp:145: error: âlicenseâ was not declared in this scope
> 
> 
> These appear to be related to two 64-bit I've declared:
> 
> unsigned __int64  serNum=0;
> unsigned __int64  license=0;
> 
> Apparently gcc doesn't recognize this format for a 64-bit
> integer.  Could someone point out what I need to put here
> to declare the 64-bit integer so gcc will accept it?

You could include the C99 'stdint.h' and use 'uint64_t' instead of 'unsigned 
__int64', but I don't know how well that goes with C++. I think nowadays (on 
x86 at least) you can achieve the same result with 'long long' on both Visual 
Studio and gcc.

-- 
Mihai Donțu



More information about the Gcc-help mailing list