Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5952

C++ error: undefined reference to 'clock_gettime' and 'clock_settime'

$
0
0

I am pretty new to Ubuntu, but I can't seem to get this to work. It works fine on my school computers and I don't know what I am not doing. I have checked usr/include and time.h is there just fine. Here is the code:

#include <iostream>#include <time.h>using namespace std;int main(){    timespec time1, time2;    int temp;    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);    //do stuff here    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);    return 0;}

I am using CodeBlocks as my IDE to build and run as well. Any help would be great, thank you.


Viewing all articles
Browse latest Browse all 5952

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>