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 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.
Edit: 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
可以了。
Blarp. Don't use lib curl, Qt has QNetworkAccessManager already which elegantly handles requests and responses using thread-safe Qt signals. Everything you need is there already.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.