gpt4 book ai didi

c++ - cURL交叉编译

转载 作者:行者123 更新时间:2023-11-30 17:12:49 30 4
gpt4 key购买 nike

如何在 Linux 上交叉编译 Windows 的“cURL”(实际上使用 kali)?或者是否有已经构建了交叉编译环境或易于构建交叉编译环境的linux发行版?请帮忙!

我让 Mingw 可以正常使用其包含目录中已有的头文件。现在我编译了 cURL 并验证了它在 Mingw 的 include 目录中的存在。但现在当我包括<curl/curl.h>时在我的代码中,这是我在编译时遇到的错误:

/tmp/ccsrpc1o.o:https.c:(.text+0x1c): undefined reference to `__imp__curl_global_init'
/tmp/ccsrpc1o.o:https.c:(.text+0x26): undefined reference to `__imp__curl_easy_init'
/tmp/ccsrpc1o.o:https.c:(.text+0x4a): undefined reference to `__imp__curl_easy_setopt'
/tmp/ccsrpc1o.o:https.c:(.text+0x5a): undefined reference to `__imp__curl_easy_perform'
/tmp/ccsrpc1o.o:https.c:(.text+0x73): undefined reference to `__imp__curl_easy_strerror'
/tmp/ccsrpc1o.o:https.c:(.text+0xb2): undefined reference to `__imp__curl_easy_cleanup'
/tmp/ccsrpc1o.o:https.c:(.text+0xbc): undefined reference to `__imp__curl_global_cleanup'
collect2: ld returned 1 exit status

最佳答案

首先使用以下命令交叉编译 cURL:

$ ./configure --host=i586-mingw32msvc --enable-http --with-zlib --with-winssl
$ make
$ make install

现在您可以编译代码了:

$ i58​​6-mingw32msvc-gcc -o https.exe https.c -lcurl

$ i586-mingw32msvc-gcc -o https.exe https.c /usr/i586-mingw32msvc/lib/libcurl.dll.a

关于c++ - cURL交叉编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31260830/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com