[英]GCC on MinGW: Protocol “https” not supported or disabled in libcurl
I'm using MinGW on Windows 10 Professional.我在 Windows 10 Professional 上使用 MinGW。
I installed libcurl with the following commands:我使用以下命令安装了 libcurl:
$ git clone https://github.com/curl/curl
$ cd curl
$ ./buildconf.bat
$ mingw32-make mingw32
$ cp lib/libcurl.a /c/MinGW/lib
$ cp -r include/curl/ /c/MinGW/include
Then I wrote the following toy C++ program to test it:然后我写了下面的玩具C++程序来测试一下:
#include <iostream>
#include <curl/curl.h>
int main(void) {
CURL *curl;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, "https://api.ecs.rocks/v0/util/removeMessageHeader");
curl_easy_perform(curl);
curl_free(curl);
return 0;
}
Then I compiled it with the following command:然后我用以下命令编译它:
$ g++ main.cpp -o curltest -m32 -DCURL_STATICLIB -lcurl -lws2_32 -lwldap32 -lwsock32 -lwinmm
Everything looks good at this point.在这一点上,一切看起来都很好。 My pwd now contains a new file named curltest.exe
.我的密码现在包含一个名为curltest.exe
的新文件。
I try running it:我尝试运行它:
$ ./curltest.exe
And I get this output:我得到了这个 output:
* Protocol "https" not supported or disabled in libcurl
* Closing connection -1
What have I done wrong?我做错了什么? How do I enable support for HTTPS in libcurl built from source on MinGW?如何在 MinGW 上从源代码构建的 libcurl 中启用对 HTTPS 的支持?
You have built libcurl without any TLS library.您已经构建了没有任何 TLS 库的 libcurl。 I suggest you having a look at the official curl guide on how to build curl on MingW32.我建议您查看官方 curl 指南,了解如何在 MingW32 上构建 curl。 It also explains what to do to enable TLS.它还解释了如何启用 TLS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.