QC libCurl binding gives a huge list of C ++ errors

I am trying to link libCurl in QT with a C ++ program on Windows 7 x64, but when I try to link libcurldll.a , I get a huge list of errors. I tried to compile a similar function with GCC g++ -LC:\MinGW\lib -lcurldll , which compiles without errors. I use the code below 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 inserted here . Some key errors: tlsthrd.c:-1: error: undefined reference to ' EnterCriticalSection@4 ' I use LIBS += -LC:\MinGW\lib -lcurldll in my .pro file to link the project to the curl library. Any idea on why this is happening? Greetings.

Edit: after a deeper look, it looks like libmingw32.a has some problems providing links to functions used for multithreading. Should I try to replace the library file? If so, why does GCC compile correctly with the same library file, but QT is not?

+4
source share
2 answers

Adding win32:LIBS += c:\MinGW\lib\libcurldll.a to the .pro file did the trick.

+2
source

Blarp. Do not use lib curl, Qt already QNetworkAccessManager already gracefully handles requests and responses using Qt signal streams. All you need is already there.

+1
source

Source: https://habr.com/ru/post/1392381/


All Articles