I tried to build the Pixel Intensity Comparison-based Object detection (pico) code in opencv 3.0, while building i got an error like error: 'CLOCK_MONOTONIC' undeclared (first use in this function) . Can any tell how to overcome these issues?? The code is as follows along with the error i got
float getticks()
{
struct timespec ts;
if(clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
{
printf("clock_gettime error\n");
return -1.0f;
}
return ts.tv_sec + 1e-9f*ts.tv_nsec;
}
and the error i got as
picolrn.c:94:18: error: storage size of 'ts' isn't known
struct timespec ts;
^
picolrn.c:96:19: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
if(clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
^
picolrn.c:96:19: note: each undeclared identifier is reported only once for each function it appears in
make.exe[2]: *** [build/Debug/MinGW_1-Windows/picolrn.o] Error 1
Add a commandline switch: -D_POSIX_C_SOURCE=199309L
when compiling.
Without it, time.h header will not define it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With