c – 在Linux for Windows下使用mingw32交叉编译时链接libcurl
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c – 在Linux for Windows下使用mingw32交叉编译时链接libcurl,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1645字,纯文字阅读大概需要3分钟。
内容图文
![c – 在Linux for Windows下使用mingw32交叉编译时链接libcurl](/upload/InfoBanner/zyjiaocheng/967/c96ce1f76951413bb4e4e648e775a0d5.jpg)
我使用mingw32编译了libcurl,并尝试使用mingw32将其与我的程序链接到我的Linux机器上的Windows系统.
我输出了libcurl-4.dll libcurl.a libcurl.la libcurl.lai文件.
我把它们包含在我的mingw32 libs文件夹中:/usr/x86_64-w64-mingw32 / lib
我能够找到一些关于链接libstdc和libgcc的其他主题,以便在执行时注意依赖性错误,但是当尝试添加libcurl.a时,它将不会编译期间.
我使用了以下内容:
$x86_64-w64-mingw32-g++ main.cpp -o hello.exe -static-libgcc -static-libstdc++ -static "/usr/x86_64-w64-mingw32/lib/libcurl.a" -lpthread
但是,我不能让它使用libcurl.a并继续收到这些错误.
/tmp/ccIceRus.o:main.cpp:(.text+0xde): undefined reference to `__imp_curl_easy_init'
/tmp/ccIceRus.o:main.cpp:(.text+0x106): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x122): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x13e): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x159): undefined reference to `__imp_curl_easy_setopt'
/tmp/ccIceRus.o:main.cpp:(.text+0x169): undefined reference to `__imp_curl_easy_perform'
/tmp/ccIceRus.o:main.cpp:(.text+0x180): undefined reference to `__imp_curl_easy_strerror'
/tmp/ccIceRus.o:main.cpp:(.text+0x197): undefined reference to `__imp_curl_easy_cleanup'
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccIceRus.o: bad reloc address 0x80 in section `.xdata'
collect2: error: ld returned 1 exit status
我究竟做错了什么?.我无法超越这个.我知道它必须是一些愚蠢的问题.
谢谢.
解决方法:
我能够通过指定-DCURL_STATICLIB以及链接其他一些依赖项来解决问题.
x86_64-w64-mingw32-g++ main.cpp -o hello.exe -DCURL_STATICLIB -static -lstdc++ -lgcc -lpthread -lcurl -lwldap32 -lws2_32
内容总结
以上是互联网集市为您收集整理的c – 在Linux for Windows下使用mingw32交叉编译时链接libcurl全部内容,希望文章能够帮你解决c – 在Linux for Windows下使用mingw32交叉编译时链接libcurl所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。