Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top