简体   繁体   中英

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

尝试与 librt ( -lrt ) 链接。

You need to link with the real-time library.
Use -lrt

gcc ... -lrt ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM