【问题标题】:Getting Error: "Protocol https not supported or disabled in libcurl" in Libcurl出现错误:Libcurl 中的“libcurl 中不支持或禁用协议 https”
【发布时间】:2020-11-10 08:39:38
【问题描述】:

我在使用 curl 进行 URL 调用时遇到了问题。

首先在curl 7.40.0版本中声明curl.h文件

#include "curl.h" // curl-7.40.0

在调用 curl 的函数中...

CURL *curl = curl_easy_init();
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL,"https://www.google.com");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, TURE);
res = curl_easy_perform(curl);

执行上述代码时,出现如下错误

同样,当我在 Linux 控制台中使用 curl 命令运行它时,它运行正常。 (卷曲版本 7.19.7)

curl https://www.google.com

你能告诉我有什么问题吗?

谢谢!

【问题讨论】:

  • 这能解决你的问题吗OP

标签: curl libcurl


【解决方案1】:

更新您的系统

sudo apt update

安装 curl 所需的任何构建依赖项

sudo apt-get build-dep curl

检查版本

curl-config --version
# (maybe here you have 7.69-xxx)
curl --version
# 7.68.0

检查路径是否正确

which curl
# /usr/local/bin/curl
whereis curl
# curl: /usr/bin/curl /usr/local/bin/curl /usr/share/man/man1/curl.1.gz
export LD_LIBRARY_PATH=/usr/local/lib

安装 LIB 以获得相同的版本

mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.68.0.tar.bz2
tar -xvjf curl-7.68.0.tar.bz2 
cd curl-7.68.0/
./configure
make
sudo make install
sudo ldconfig

检查是否有相同的版本

curl-config --version
curl --version

【讨论】:

    猜你喜欢
    • 2019-08-06
    • 2012-03-24
    • 2017-01-10
    • 2019-07-27
    • 1970-01-01
    • 2017-09-14
    • 2020-01-22
    • 2017-09-08
    • 2020-04-09
    相关资源
    最近更新 更多