g++ compile problem using inttypes.h

Lars Schoenberg lars.schoenberg@email.de
Tue Oct 24 11:00:00 GMT 2006


Hi,

I've got a problem using unsigned long long int whecn compiling with g++

For convinient formatted output of a 64bit integer I'm using inttypes.h
gcc is running fine on my machine but g++ doesn't compile - no matter using
3.4.6 or 4.1.1
Error message shown is:
-----------------
intmax2.c: In function 'int main()':
intmax2.c:10: error: expected `)' before 'PRIx64'
-----------------

A friend of mine is able to compile this under cygwin and on a SUN machine
the code is also running perfectly fine but on linux 2.4.x and 2.6.x I don't
get the code compiled.

Code snippet:
#include <stdio.h>
#include <inttypes.h>

int main( void )
{
int shift;
for ( shift = 0; shift < 64; ++shift )
{
unsigned long long int a = 1ULL << shift;
printf("shift = %2d, a = %016"PRIx64"\n", shift, a);
}
return 0;
-- 
View this message in context: http://www.nabble.com/g%2B%2B-compile-problem-using-inttypes.h-tf2500555.html#a6970711
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list