在QT中链接libCurl会给出大量的C ++错误列表 [英] Linking libCurl in QT gives a huge list of errors C++
问题描述
我试图将QT中的libCurl链接到Windows 7 x64上的C ++程序,但是当我尝试链接libcurldll.a
时,出现了大量错误.我尝试用GCC g++ -LC:\MinGW\lib -lcurldll
编译类似的函数,而编译时没有错误.我在QT和GCC中使用以下代码.
I am trying to link libCurl in QT to a C++ program on Windows 7 x64, but when I try to link libcurldll.a
, I get a huge list of errors. I have tried compiling a similar function with GCC g++ -LC:\MinGW\lib -lcurldll
which compiles without errors. I am using the below code in QT and GCC.
void MainWindow::on_pushButton_2_clicked()
{
CURL *curl;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
QT为我提供了此处粘贴的大量错误列表.一些关键错误是tlsthrd.c:-1: error: undefined reference to 'EnterCriticalSection@4'
我正在使用.pro
文件中的LIBS += -LC:\MinGW\lib -lcurldll
将项目链接到curl库.知道为什么会这样吗?干杯.
QT gives me a huge list of errors that I have pasted here. Some of the key errors are tlsthrd.c:-1: error: undefined reference to 'EnterCriticalSection@4'
I am using LIBS += -LC:\MinGW\lib -lcurldll
in my .pro
file to link the project to the curl library. Any idea as to why this is happening? Cheers.
更深入地了解之后,似乎libmingw32.a
在提供用于多线程功能的引用方面遇到了一些问题.我应该尝试替换库文件吗?如果是这样,为什么GCC可以使用相同的库文件正确编译,而QT却不能?
After a deeper look, it appears as if libmingw32.a
is having some issues providing references to functions used for multi-threading. Should I try and replace the library file? If so, why is GCC compiling correctly with the same library file but QT is not?
推荐答案
在.pro
文件中添加win32:LIBS += c:\MinGW\lib\libcurldll.a
可以达到目的.
Adding win32:LIBS += c:\MinGW\lib\libcurldll.a
to the .pro
file did the trick.
这篇关于在QT中链接libCurl会给出大量的C ++错误列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!