没有_SC_CLK_TCK的定义

时间:2012-09-18 10:21:11

标签: linux

我正在使用嵌入式Linux 2.6.36

我需要那个序列:

ticksPerSecond=sysconf(_SC_CLK_TCK); // ticks per sec

但是我收到了这个错误

semLib.c:96: error: '_SC_CLK_TCK' undeclared (first use in this function)
semLib.c:96: error: (Each undeclared identifier is reported only once
semLib.c:96: error: for each function it appears in.)

我没有找到

的定义
  

_SC_CLK_TCK

我发现它应该在linux / time.h中。但事实并非如此。

2 个答案:

答案 0 :(得分:4)

试试#include <unistd.h>。它包括带有此定义和其他定义的标题。

答案 1 :(得分:0)

在我的debian 6上,同样的问题

xxx.c:47: error: '_SC_CLK_TCK' undeclared (first use in this function)

我发现了这个:

/usr/include/bits/time.h:41:#   define CLK_TCK ((__clock_t) __sysconf (2))      /* 2 is _SC_CLK_TCK */

哪个说你可以用(2)代替:) 对我来说,它每秒返回100个刻度(仅!)