【问题标题】:Error in clock_gettime in ctimectime 中的clock_gettime 错误
【发布时间】:2013-01-08 05:59:57
【问题描述】:

我有这个功能:

void Estatisticas::iniciarTempo() {

clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tempoInicial); 

}

我正在尝试通过 ctime 使用clock_gettime,但出现了一些错误:

“对‘clock_gettime’的未定义引用”

非常感谢。

【问题讨论】:

    标签: ctime


    【解决方案1】:

    来自 clock_gettime/clock_getres 手册页:

    使用 -lrt 链接。

    符号在 POSIX 实时库中定义。将“-lrt”添加到您的编译行:

    gcc -lrt -o myprog myprog.c
    

    【讨论】:

      猜你喜欢
      • 2013-06-24
      • 1970-01-01
      • 1970-01-01
      • 2017-03-23
      • 2016-09-05
      • 1970-01-01
      • 2012-10-15
      • 2012-09-27
      • 1970-01-01
      相关资源
      最近更新 更多