To use clock_gettime
what library do I need to link with? I am getting linker errors that clock_gettime
is undefined.
Asked
Active
Viewed 498 times
1

dongle26
- 826
- 1
- 10
- 18
1 Answers
3
Try linking to librt
:
gcc -o myprog myprog.c -lrt
(also note that you have to put the -lrt
flag after specifying the myprog.c
source file!)
-
You just need to put `-lrt` *after* `myprog.c` and you could put `-o myprog` at last. – Basile Starynkevitch Oct 06 '12 at 21:00
-
@BasileStarynkevitch that's true. – Oct 06 '12 at 21:07