Format specifier for uint64_t

  • csr18

    csr18 - 2011-03-10


    Pasted below is a small piece of code I am having trouble with when I use -ansi to compile it. This works fine with mingw32. Would appreciate any suggestions on how to fix this. I am using gcc-4.5.0

    $ cat test.c
    #include <stdio.h>
    #include <stdint.h>

    int main() {
            uint64_t foo = 5;
            fprintf(stderr, "VC: foo=%llu\n", foo);
            return 0;

    Command line used:

    gcc -ansi -pedantic -Wall test.c


    test.c: In function 'main':
    test.c:6:2: warning: unknown conversion type character 'l' in format
    test.c:6:2: warning: too many arguments for format

  • Jonathan Yong

    Jonathan Yong - 2011-03-11

    I don't there are 64bit types for ANSI, so %llu might make little sense.

    In any case, you should be using %I64u if using msvcrt printf family.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks