我在 C 程序中收到 Curl 错误代码 4,但我无法弄清楚出了什么问题



我是curl库的新手,昨天我从GitHub安装了它,我按照步骤下载了它,通过检查支持的协议,一切似乎都很好;但当我试图使用C程序中的库从https链接下载数据时,我得到了错误4。

支持的协议,没有任何问题:

curl 7.83.0-DEV (x86_64-pc-linux-gnu) libcurl/7.83.0-DEV OpenSSL/1.1.1m zlib/1.2.11
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets

但是当我试着运行我的C程序时,我得到了这个:

./test https://google.com
ERROR: A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.

我写的代码是这样的:

#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
void main(int argc, char *argv[])
{
CURL *curl = curl_easy_init();      
int success = 0;                    
FILE *data = fopen("data", "wb");
if(data==NULL)
{
printf("Error making file for data to be stored.n");
exit(1);
}
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, data);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
success = curl_easy_perform(curl);
if(success==CURLE_OK)
printf("Download successful.n");
else 
printf("ERROR: %sn", curl_easy_strerror(success));
fclose(data);
curl_easy_cleanup(curl);
}
type here

有人知道怎么了??

链接系统libcurl.so运行时是7.83.0-DEV.之外的另一个运行时

sudo apt intstall ibcurl4-openssl-dev

sudo apt intstall  libcurl4-gnutls-dev

相关内容

最新更新