lovelypengpeng 发表于 2004-3-31 10:24:49

编了一个小小的程序,竟然不能编译, 提示:

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.

felix 发表于 2004-3-31 12:05:30

struct time_val now;错了!
改为
struct timeval now;
即可!

lovelypengpeng 发表于 2004-4-2 08:22:17

谢谢已成功!
页: [1]
查看完整版本: 编了一个小小的程序,竟然不能编译, 提示: