使用clock_gettime时我收到链接器错误

时间:2012-10-06 18:02:43

标签: linux linker-errors standard-library gettickcount

要使用clock_gettime我需要链接哪个库?我收到clock_gettime未定义的链接器错误。

1 个答案:

答案 0 :(得分:3)

尝试链接到librt

gcc -o myprog myprog.c -lrt

(另请注意,在指定-lrt源文件后必须放置myprog.c标志!)

相关问题