编了一个小小的程序,竟然不能编译, 提示:
test.c 内容如下:#include <stdio.h>
#include <sys/time.h>
int main(int argc, char *argv[])
{
struct time_val now;
gettimeofday(&now, NULL);
printf("Status report type %s \n", ctime(&(now.tv_sec)));
return 0;
}
gcc test.c -o test,提示:
storage size of 'now' isn't know. struct time_val now;错了!
改为
struct timeval now;
即可! 谢谢已成功!
页:
[1]