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

#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>

https://stackoverflow.com/questions/6840695/

相关文章:

python - 安装Python库时出错?

python - Mac OS X中的python错误 undefined symbol : “_P

compiler-errors - 试图获取yacc代码进行编译

c# - 在LINQ中设置或更新数据

actionscript-3 - AS3在第一个音频文件完成播放后播放第二个音频文件

date - 不同时区的同一日期

installation - 编译后ISTool错误

emacs - 字节编译错误

compiler-errors - mingw提供错误-C编译器无法创建可执行文件

.net - Visual Studio Web引用错误