dongle26
dongle26

Reputation: 856

I am getting linker errors when using clock_gettime

To use clock_gettime what library do I need to link with? I am getting linker errors that clock_gettime is undefined.

Upvotes: 1

Views: 507

Answers (1)

user529758
user529758

Reputation:

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!)

Upvotes: 3

Related Questions