相关疑难解决方法(0)

如何printf uint64_t?失败:"格式中的虚假尾随'%'

我写了一个非常简单的printf uint64_t测试代码:

#include <inttypes.h>
#include <stdio.h>

int main()
{
  uint64_t ui64 = 90;
  printf("test uint64_t : %" PRIu64 "\n", ui64);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

我使用ubuntu 11.10(64位)和gcc版本4.6.1进行编译,但失败了:

main.cpp: In function ‘int main()’:
main.cpp:9:30: error: expected ‘)’ before ‘PRIu64’
main.cpp:9:47: warning: spurious trailing ‘%’ in format [-Wformat]
Run Code Online (Sandbox Code Playgroud)

c c++

132
推荐指数
1
解决办法
10万
查看次数

标签 统计

c ×1

c++ ×1