How to use/configure cURL on Qt Creator?
By a few days I'm trying to use cURL on my Qt project. But I got many headaches and I decided to ask you.
When I'm trying to use cURL functions I got this error:
@mainwindow.obj : error LNK2019: unresolved external symbol __imp_curl_easy_init referenced in function "private: void __cdecl MainWindow::on_pushButton_clicked(void)" (?on_pushButton_clicked@MainWindow@@AEAAXXZ)
debug\Curl.exe : fatal error LNK1120: 1 unresolved externals@
The main program looks like:
MainWindow::MainWindow(QWidget *parent) :
curl = curl_easy_init();
I'm using Visual Studio 2012 Compiler
And the curl files from Microsoft Visual Studio 11.0\VC\include\curl :
I've read on other forums that I have to add library dependency, but I'm beginer with Qt and I don't know hot to do that.
Hi and welcome to devnet,
If you are using QtCreator, right click on your project and select Add Library, then point it to your curl lib file.
You should be good to go then
I've donne that, but is a problem with libs and get this error:
@LINK : fatal error LNK1104: cannot open file 'libcurl_imp.lib'@
I've added libs as externals and set correct path to these but still get this error.
Why can't open libs?
Do you have the path properly quoted ?
I am also wondering what does these files do in Visual Studio's installation
Yes, was correct. Is the full curl folder moved by me on includes/ directory from VC.
That's generally a bad idea to move files around like that on windows.
However my problems is not solved. I want to explain again, maybe now I will get the solution.
Curenntly I have installed qt-windows-opensource-5.1.1-msvc2012-x86_64-offline
And I've downloaded this version of libcurl:
The curl folder is:
I have moved include include folder to VS include folder and I've included in program with *#include <curl/curl.h> * and works good.
Now on the lib folder are another two folders with names: Debug and Release
and both have these files inside:
And now when I try to run a simple program i got:
If you can't understand from images you can download archive with curl right here:
I've tried to include libs on project but failed, everytime I got the same error. Probably I'm now including libs fine (internal/external or dynamic/static) and I don't know which one to include and how. And there are some .dll files too that I don't know what to do with.
Have someone succesfully used libcurl on Qt projects? I'm beginer on Qt and it's hard for me...