使用 mingw32 和 libcurl32 使用 libcurl 编译适用于 Windows 的 C 源代码。命令行如下:
gcc -c -I "c:\curl\include" -L "c:\curl\lib" -o simple.exe simple.c
Run Code Online (Sandbox Code Playgroud)
编译运行成功,生成exe文件。但是当我尝试运行它时,我收到消息:
不受支持的 16 位应用程序。由于与 64 位版本的 Windows 不兼容,程序或功能“simple.exe”无法启动或运行。
gcc(MinGW-W64 i686-ucrt-posix-dwarf,由 Brecht Sanders 构建)12.2.0
curl 7.83.1 (Windows) libcurl/7.83.1 Schannel 发布日期:2022-05-13 协议:dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp 功能:AsynchDNS HSTS IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI UnixSockets
我的代码:
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) { …Run Code Online (Sandbox Code Playgroud)