【发布时间】:2015-05-11 18:28:43
【问题描述】:
我正在尝试使用 timerfd_create() 和 timer_settime() 在 C 中编写一个计时器。 我正在使用 CLOCK_MONOTONIC。但是虽然我包含了这些头文件,
#include <sys/timerfd.h>
#include <sys/time.h>
#include <sys/types.h>
struct itimerspec timerValue; //This is how i defined the structure
//some code
g_fdRetryTimer = timerfd_create(CLOCK_MONOTONIC, 0);
我一直收到以下编译错误。
error: storage size of ‘timerValue’ isn’t known
error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
请帮忙!谢谢。
【问题讨论】:
-
请用标志显示你的编译命令。
-
我使用 gcc ctimer.c -o ctimer.
标签: c