Tutorial – libCURL on Qt Creator with MinGW

libcurl on qt with mingw

Using libCURL on Qt Creator with MinGW as compiler can give you many headaches when you try to add libCURL references on your Qt project. So, In next words I will help you to use libCURL inside your Qt project. If you don’t link/add libCURL correctly to project you will get ‘unresoved_externals’ and other similar errors.

What is libCURL?

What Wikipedia says:

libcurl is a free client-side URL transfer library, supporting FTP, FTPS, Gopher, HTTP, HTTPS, SCP, SFTP, TFTP, Telnet, DICT, the file URI scheme, LDAP, LDAPS, IMAP, POP3, SMTP and RTSP.

In other words If you develop a software on C/C++ with Qt and if you want to use FTP of sent an HTTP request for example you should use libcurl because is a good library for this work and is free for any use. The official website: http://curl.haxx.se/libcurl/

Downloading resources:

For this tutorial I’m using Qt 5.2.1 for Windows 32-bit (MinGW 4.8, OpenGL, 634 MB). You can find the version here: http://qt-project.org/downloads

I’m also using MinGW64 7.34.0 devel SSL SSH Günter Knauf 2.18 MB available to download here: libcurl for qt

Using libCURL on Qt Creator Project:

Assuming that you have downloaded curl-7.34.0-devel-mingw32 and unzipped to C:\Libs\C\curl-7.34.0-devel-mingw32 you have now to:

DoubleClick on your project name (project_name.pro – left corner>UP) and there add:

INCLUDEPATH += C:\Libs\C\curl-7.34.0-devel-mingw32\include
LIBS += C:\Libs\C\curl-7.34.0-devel-mingw32\lib\libcurldll.a

Now go to C:\Libs\C\curl-7.34.0-devel-mingw32\bin and copy all files from this folder to your Qt Debug/Release Folder:

libcurl bin how to use on qt

Now on your C/C++ file include libCURL dependencies using:

#include <curl/curl.h>


You know now how to use liCURL library on C/C++ Qt Application and you are able to make we requests on C/C++ and many more!

Any example of how to use libCURL you will find here: http://curl.haxx.se/libcurl/c/example.html

2 Comments on "Tutorial – libCURL on Qt Creator with MinGW"

  1. swani says:

    Man, thank you very much
    Very useful article!!!!

  2. Ganesh says:

    I did what you mentioned and am getting bunch of errors:

    C:gitQTtestingQTmain.cpp:-1: error: undefined reference to `_imp__curl_easy_init’

    Can you help me with this? I have had a hard time doing this.

Got something to say? Go for it!