我无法编译,我在Odroid-XU4板上使用Ubuntu。我该如何解决这个问题?谢谢你的帮助。未定义的libcurl函数引用
[email protected]:~/Desktop/curl_test.2$ g++ -o postit2 postit2.c -lcurl
/tmp/cc4MoKQE.o: In function `main':
postit2.c:(.text+0x2c): undefined reference to `curl_mime_init'
postit2.c:(.text+0x36): undefined reference to `curl_mime_addpart'
postit2.c:(.text+0x48): undefined reference to `curl_mime_name'
postit2.c:(.text+0x56): undefined reference to `curl_mime_filedata'
postit2.c:(.text+0xfa): undefined reference to `curl_mime_free'
collect2: error: ld returned 1 exit status
[email protected]:~/Desktop/curl_test.2$ curl --version
curl 7.56.0 (armv7l-unknown-linux-gnueabihf) libcurl/7.47.0
OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Release-Date: 2017-10-04
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps
pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM
NTLM_WB SSL libz TLS-SRP UnixSockets
也许您还安装了另一个libcurl版本,g ++在链接时会启动?它只会警告7.56.0中新增的API调用... –
应该做什么?我需要删除所有版本并尝试安装libcurl 7.56.0? –
你可以做到这一点;你也可以安装和构建你想要的版本的Curl源代码,但不安装它。然后让程序通过在新的Curl构建中指定它们的实际文件系统位置,为新的Curl版本选择标题和静态库。如果您需要从源代码构建,安装新Curl的问题在于,最终构建缺少SSL支持或其他有用功能的版本非常容易。如果你能从你的发行版中获得你想要的版本,那不太可能是个问题。但您的发行版可能没有该版本。 –