【发布时间】:2012-11-15 10:59:16
【问题描述】:
如何使用 GCC 在 C99 中 printf long long int 和 unsigned long long int?
我搜索了其他建议使用%lld 的帖子,但它给出了以下警告:
警告#1:格式为 [-Wformat]|
的未知转换类型字符“l” 警告#2:格式参数过多 [-Wformat-extra-args]|
对于以下尝试:
#include <stdio.h>
int main()
{
long long int x = 0;
unsigned long long int y = 0;
printf("%lld\n", x);
printf("%llu\n", y);
}
【问题讨论】:
-
你在编译时是否使用了
-std=c99标志? -
我没有收到任何警告:i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1(基于 Apple Inc. build 5658)(LLVM build 2335.15.00)
-
@netcoder:我不确定如何查找版本。我在 Windows x86 上运行 gcc。
-
啊,它是 gcc 版本 4.6.1。谢谢@effeffe。
-
您使用的是哪个版本的 Windows?