QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 993|回复: 2

why compile error???

[复制链接]
发表于 2004-5-17 17:37:52 | 显示全部楼层 |阅读模式
my program:
[code:1]

#include <time.h>
#include <unistd.h>
int main()

{

time_t timep;
time (&timep);
printf("use asctime(gmtime(&timep)): %s\n", asctime(gmtime(&timep)));

printf("use ctime(&timep): %s timep is a varible of time_t. \n",ctime(&timep));

struct timevar tv;
struct timezone tz;

gettimeofday(&tv, &tz);

printf("tv_sec is %d\n", tv.tv_sec);
printf("tv_usec is %d\n", tv.tv_usec);
printf("tz_miniuteswest is %d\n", tz.tz_miniuteswest);
printf("tz_dsttime is %d\n", tz.tz_dsttime);

return 1;
}[/code:1]
use :  gcc -o testtime testtime.c
compile error message:
testtime.c: In function `main':
testtime.c:13: storage size of `tv' isn't known
testtime.c:14: storage size of `tz' isn't known
发表于 2004-5-17 19:06:21 | 显示全部楼层
不认识你的timevar(我想是timeval) 和timezone(加include  <sys/time.h>。
回复

使用道具 举报

 楼主| 发表于 2004-5-17 21:17:38 | 显示全部楼层
果然是搞错了。多谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-8 09:05 , Processed in 0.041481 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表