cUrl:未定义的引用 [英] cUrl: Undefined reference

查看:3018
本文介绍了cUrl:未定义的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中使用cUrl,但我得到了几个错误。我已经试图在g或这里找到一个解决方案,但没有什么帮助。
我构建和链接cUrl为静态,有libcurl.a设置在链接器,有适当的包括但它仍然不工作。

I am trying to use cUrl in my app but i am getting several errors. I already tried to find a solution on g or here, but nothing helped. I build and link cUrl as static, have libcurl.a set up in linker, have proper includes but it still doesn't work.

我试过将-lcurl添加到构建设置中,但似乎不知道该标记。

I tried adding -lcurl into build settings but seems like it doesn't know that flag.

我使用cUrl 7.46.0 build --disable - static和--without - ssl
和Code :: Blocks ide& mingw编译器// c ++ ofc

I am using cUrl 7.46.0 build with --disable--static and --without--ssl and Code::Blocks ide & mingw compiler // c++ ofc

以下是这些错误:

obj\Release\src\HTTPDownloadRequest.o:HTTPDownloadRequest.cpp| undefined reference to `_imp__curl_easy_cleanup'
obj\Release\src\HTTPDownloadRequest.o:HTTPDownloadRequest.cpp| undefined reference to `_imp__curl_easy_cleanup'
obj\Release\src\HTTPDownloadRequest.o:HTTPDownloadRequest.cpp| undefined reference to `_imp__curl_easy_init'
obj\Release\src\HTTPDownloadRequest.o:HTTPDownloadRequest.cpp| undefined reference to `_imp__curl_easy_setopt'
obj\Release\src\HTTPDownloadRequest.o:HTTPDownloadRequest.cpp| undefined reference to `_imp__curl_easy_perform'

编译命令:

mingw32-g++.exe -LC:\WXWID\lib\gcc_lib -o bin\Release\app.exe obj\Release\app.o obj\Release\appMain.o obj\Release\appHistory.o obj\Release\src\HTTPDownloadRequest.o  obj\Release\resource.res -s -static-libgcc -static-libstdc++ -static -mthreads  -lwxmsw30u_core -lwxbase30u -lwxpng -lwxjpeg -lwxtiff -lwxzlib C:\WXWID\lib\gcc_lib\libwxmsw30u_adv.a "C:\curl\lib\libcurl.a" -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows

使用时出错定义CURL_STATICLIB

Errors when used define CURL_STATICLIB

C:\curl\lib\libcurl.a(libcurl_la-connect.o)| undefined reference to `WSAIoctl@36'
C:\curl\lib\libcurl.a(libcurl_la-ldap.o)| undefined reference to `_imp__ldap_err2stringA'
C:\curl\lib\libcurl.a(libcurl_la-ldap.o)| undefined reference to `_imp__ldap_msgfree'
C:\curl\lib\libcurl.a(libcurl_la-ldap.o)|| undefined reference to `_imp__ldap_unbind_s'
...


推荐答案

如果您试图链接到静态libcurl添加 -DCURL_STATICLIB 到gcc参数或定义 CURL_STATICLIB 宏,以使用正确的修改。

If you try to link with static libcurl add -DCURL_STATICLIB to gcc arguments or define CURL_STATICLIB macro before including its headers to use correct mangling.

这篇关于cUrl:未定义的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆