Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to use/configure cURL on Qt Creator?
QtWS25 Last Chance

How to use/configure cURL on Qt Creator?

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 3 Posters 12.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    curiosul
    wrote on 27 Aug 2013, 09:35 last edited by
    #1

    Hello!

    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:

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    #include <curl/curl.h>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_pushButton_clicked()
    {
    //shits here
    CURL *curl;
    curl = curl_easy_init();
    }@

    I'm using Visual Studio 2012 Compiler

    And the curl files from Microsoft Visual Studio 11.0\VC\include\curl :
    !http://img856.imageshack.us/img856/359/1r58.png(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.

    thanks.

    Cea mai buna batalie este cea castigata fara lupta.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Aug 2013, 10:34 last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        curiosul
        wrote on 27 Aug 2013, 11:17 last edited by
        #3

        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?

        Edit: Finally after spenting other some hours of searching this tutorial saves my life:
        "http://www.cplusplus.com/forum/general/89488/":http://www.cplusplus.com/forum/general/89488/

        Cea mai buna batalie este cea castigata fara lupta.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Aug 2013, 16:24 last edited by
          #4

          Do you have the path properly quoted ?

          I am also wondering what does these files do in Visual Studio's installation

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            curiosul
            wrote on 27 Aug 2013, 17:03 last edited by
            #5

            Yes, was correct. Is the full curl folder moved by me on includes/ directory from VC.

            Cea mai buna batalie este cea castigata fara lupta.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 27 Aug 2013, 18:53 last edited by
              #6

              That's generally a bad idea to move files around like that on windows.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • C Offline
                C Offline
                curi0sul
                wrote on 21 Sept 2013, 19:20 last edited by
                #7

                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:
                !http://img13.imageshack.us/img13/7157/yv4z.png(qt curl)!

                The curl folder is:
                !http://img13.imageshack.us/img13/1416/reh8.png(123)!

                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:

                !http://img854.imageshack.us/img854/4610/7993.png(123)!

                And now when I try to run a simple program i got:

                !http://img585.imageshack.us/img585/7476/4qjw.png(qt)!

                If you can't understand from images you can download archive with curl right here:
                http://curl.haxx.se/download/libcurl-7.19.3-win32-ssl-msvc.zip

                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...

                Thanks.

                Learn How to fix Anything -> http://howtofix.pro

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved