Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
637 views
in Technique[技术] by (71.8m points)

c - Getting undefined reference to 'clock_gettime' error, for curl program

Gretings,

I have cross compile, OpenSSl , libssh2 and finally cURL, Don't know why it has generated only static library. Anyway I tried to run sample ftpget.c program by linking all the three libraries but I am getting the following error :

.../libcurl.a(timeval.o): In function 'curlx_tvnow':
timeval.c:(.text+0xfc): undefined reference to 'clock_gettime'
collect2: ld return  1 exit status
make: *** [all] Error 1

Please help me resolve this error, Is there need to cross-compile any other library also ?

Thanks, Yuvi

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try linking with librt (-lrt).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...