gpt4 book ai didi

time - 无法使用struct tms编译代码

转载 作者:行者123 更新时间:2023-12-02 10:55:42 26 4
gpt4 key购买 nike

#if defined(HAVE_TIMES)
#include <unistd.h>
static double cycles_diff(struct tms *a,struct tms *b)
{

clock_t aa = a->tms_utime +
a->tms_stime +
a->tms_cutime +
a->tms_cstime;

clock_t bb = b->tmstms_utime
+ b->tms_stime
+ b->tms_cutime
+ b->tms_cstime;

return (aa-bb)/(double)sysconf(_SC_CLK_TCK);
}
}

这会带来错误

incomplete type declaration of struc tms





sysconf was not declared

最佳答案

According to the manual您需要#include <sys/times.h>

关于time - 无法使用struct tms编译代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6840695/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com