gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Apache protable runtime 1.4
c89 and compiling in -m32 mode代码:
apr_time_t time_msecs = 0;
time_msecs = apr_time_as_msec(apr_time_now());
printf("Time in msecs [ %lu ]\n", time_msecs);我得到以下警告:
format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘apr_time_t’ [-Wformat]除了选角。此类型(apr_time_t)的正确格式说明符是什么?
非常感谢您的建议,
发布于 2011-11-01 15:37:13
APR包含一个名为APR_TIME_T_FMT的宏,它可以执行您想要的操作。
在构建格式字符串时,您可以这样使用它(假设它的工作方式类似于stdint宏):printf("time: %" APR_TIME_T_FMT, value);
您也可以简单地将值转换为适当的类型。
发布于 2011-11-01 15:37:14
尝试:
printf("The current time: %" APR_TIME_T_FMT "[us]\n", apr_time_now());Tutorial。
https://stackoverflow.com/questions/7963580
复制相似问题