error: unknown conversion type character 'l' in format - scanning long long

c, c99, scanf

Solution

Just wanted to add this snippet too:

MinGW-w64 - for 32 and 64 bit Windows / [Mingw-w64-public] -Wformat and %llu

the issue is that formatter-width specifier %ll isn't supported for all msvcrt-DLL versions, therefore gcc warns about its use. The variant for specifying 64-bit integer-scalar-width in formatter for msvcrt in a backward-compatible way is by using %I64.

Use %I64u on Windows, or just use inttypes.h PRIuMAX.

If you must use %llu, define __USE_MINGW_ANSI_STDIO macro before including stdio.h. Be aware that if you do this, MS type %I64* format will no longer work.

Problem

I'm trying to get `long long` from the console using standard IO function `scanf`. I started with `%lld`: ``` scanf("%lld", &rule); ``` That throws: ``` error: unknown conversion type character 'l' in format [-Werror=format=] ``` I've found more workarounds, but they too throw errors: ``` scanf("%I64d", &rule); ->error: ISO C does not support the 'I64' ms_scanf length modifier [-Werror=format=] scanf("%"SCNd64"", &rule); ->error: expected ')' before 'SCNd64' ``` Am I doing something wrong? Is there an another trick? I'm compiling on very recent version of MinGw GCC with these flags: `-pedantic -Wall -Werror -std=c99 -g -D HOME=1`

Original source

Related problems