libpcap 中调用ctime()时警告提示:

warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]  
 例如: printf("%s", ctime((const time_t *)&protocol_header.ts.tv_sec));

加上ctime的头文件<time.h>就可以解决。

理由:在64位的Linux 下,int是32位的,而指针(在这里是 char *)是64位的。问题应该就是出在这里!
 
  同样的问题在用inet_ntoa()时也容易出现!!

原文地址:https://www.cnblogs.com/soyo/p/5601847.html