QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 452|回复: 2

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

[复制链接]
发表于 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.
发表于 2004-3-31 12:05:30 | 显示全部楼层
struct time_val now;  错了!
改为
struct timeval now;
即可!
回复

使用道具 举报

 楼主| 发表于 2004-4-2 08:22:17 | 显示全部楼层
谢谢已成功!
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-9-29 17:31 , Processed in 0.044856 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

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