c - Compilation error for using struct itimerspec -
i trying write timer in c using timerfd_create() , timer_settime(). using clock_monotonic. though include these header files,
#include <sys/timerfd.h> #include <sys/time.h> #include <sys/types.h> struct itimerspec timervalue; //this how defined structure //some code g_fdretrytimer = timerfd_create(clock_monotonic, 0); i consistently getting following compilation errors.
error: storage size of ‘timervalue’ isn’t known error: ‘clock_monotonic’ undeclared (first use in function) error: (each undeclared identifier reported once error: each function appears in.) please help! thanks.
gcc < 5.1.0 default standard -std=gnu90. version 5.1.0, changed default -std=gnu90 -std=gnu11.
you should compile code -std=gnu99 have identifier clock_monotonic available.
this answer might provide more details.
Comments
Post a Comment