/Mingw32/bin/ld.exe:找不到-llibcurl? [英] /Mingw32/bin/ld.exe: cannot find -llibcurl?
问题描述
我正在尝试为我的项目编译Libcurl,但我收到以下错误。
g ++ -g -o Main。 exe Main.o LC:\Test\src\WebSocket \lib-D_WIN32_WINNT = 0x0601 -DWINVER = 0x0601 -DCURL_STATICLIB -llibcurl
/ mingw32 / bin / ld.exe:找不到-llibcurl
当我构建libcurl usinf mingw32时,我有两个文件,即libcurl.a ,libcurl.la。
我在< c:\test\src\websocket \lib>下添加了两个文件。
我不知道为什么链接器无法链接这些库。
任何具有良好编译器和libcurl理解能力的人都能为此提供帮助吗?
我尝试了什么:
最初我收到的错误如下:
main.cpp:11:未定义引用__imp__curl_easy_init'
main.cpp:13:对__imp__curl_easy_setopt的未定义引用'
main.cpp:14:对__imp的未定义引用__curl_easy_perform'
main.cpp:17:对__imp__curl_easy_cleanup的未定义引用'
然后我意识到我需要链接我的libcurl库,我做了如下:
WS_DIR =C:\Test \src\WebSocket\curl
WS_LIB =C: \Test\src\WebSocket \lib
g ++ -c -std = c ++ 11 -g -fpermissive src / Main.cpp -I $ {WS_DIR} -D_WIN32_WINNT = 0x0601 -DWINVER = 0x0601 -L $ {WS_LIB} -DCURL_STATICLIB -llibcurl
我使用mingw32编译了cURL。
但现在我正面临链接问题。
请帮助。
I am trying to compile Libcurl for my project but I am getting below error.
g++ -g -o Main.exe Main.o L"C:\Test\src\WebSocket\lib" -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -DCURL_STATICLIB -llibcurl
/mingw32/bin/ld.exe: cannot find -llibcurl
When I built libcurl usinf mingw32 I got two files i.e. libcurl.a, libcurl.la.
I added both files under <c:\test\src\websocket\lib>.
I am not sure why linker is unable to link these libraries.
Can anybody with good compiler and libcurl understanding help for this?
What I have tried:
Initially I was getting error like :
main.cpp:11: undefined reference to __imp__curl_easy_init'
main.cpp:13: undefined reference to __imp__curl_easy_setopt'
main.cpp:14: undefined reference to __imp__curl_easy_perform'
main.cpp:17: undefined reference to __imp__curl_easy_cleanup'
Then I realized I need to link my libcurl library which I did as below:
WS_DIR = "C:\Test\src\WebSocket\curl"
WS_LIB = "C:\Test\src\WebSocket\lib"
g++ -c -std=c++11 -g -fpermissive src/Main.cpp -I${WS_DIR} -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -L${WS_LIB} -DCURL_STATICLIB -llibcurl
I have compiled cURL using mingw32.
But now i am facing linking issue.
please help.
推荐答案
{WS_DIR} -D_WIN32_WINNT = 0x0601 -DWINVER = 0x0601 -L
{WS_DIR} -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -L
{WS_LIB} -DCURL_STATICLIB -llibcurl
我使用mingw32编译了cURL 。
但现在我正面临链接问题。
请帮助。
{WS_LIB} -DCURL_STATICLIB -llibcurl
I have compiled cURL using mingw32.
But now i am facing linking issue.
please help.
如果你看密切关注链接选项 - 使用GNU编译器集合(GCC) [ ^ ],你会看到该选项应该是 -lcurl
。
If you look closely at the Link Options - Using the GNU Compiler Collection (GCC)[^], you would see that the option should be -lcurl
.
这篇关于/Mingw32/bin/ld.exe:找不到-llibcurl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!