获取关于curl程序的“clock_gettime”错误的未定义引用

时间:2022-12-27 12:17:59

Gretings,

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 :

我有交叉编译,OpenSSl, libssh2,最后还有cURL,不知道为什么它只生成静态库。不管怎样,我试着运行样本ftpget。c程序通过链接这三个库,但是我得到了以下错误:

.../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

谢谢,Yuvi

2 个解决方案

#1


10  

Try linking with librt (-lrt).

尝试连接librt (-lrt)。

#2


3  

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

您需要链接到实时库。使用轻轨车

gcc ... -lrt ...

#1


10  

Try linking with librt (-lrt).

尝试连接librt (-lrt)。

#2


3  

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

您需要链接到实时库。使用轻轨车

gcc ... -lrt ...