undefined reference to `clock_gettime'
От: dekorator88  
Дата: 27.12.14 17:48
Оценка:
всем доброго времени суток,подскажите пожалуйста где я накосячил в данном коде(прога не написана до конца):

#include<stdio.h>
#include <unistd.h>
#include<stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <math.h>

int main(int argc,char *argv[])
{
struct timespec tp;
double startTime,endTime;

if(argc <= 2)
{
printf( "Usage: %s <number>\n", argv[0] );
return( EXIT_SUCCESS );
}

if(clock_gettime(CLOCK_REALTIME,&tp) == -1)
{
perror("clock_gettime failed");
exit( EXIT_FAILURE );
}

startTime = (((double)tp.tv_sec * pow(10,9)) + (double)tp.tv_nsec);

printf("%f\n",startTime);

return 0;


}


компилирую и получаю данную ошибку: undefined reference to `clock_gettime'

всем спасибо
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.