Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem setting up Curl
Forum Updated to NodeBB v4.3 + New Features

Problem setting up Curl

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 336 Views 2 Watching
  • 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.
  • G Offline
    G Offline
    GeertDaelemans
    wrote on last edited by
    #1

    I am trying to revive a project witten in an older version of Qt. It contains implementations based upon cUrl.
    But I don't seem to get the cUrl stuff to work. It builds seemingly ok, but then keeps crashing (The program has unexpectedly finished.)

    Btw I am a newbie at this...

    For demonstration purposes I have reduced my code to the absolute minimum.

    Error message:

    11:54:25: Starting D:\Workspaces\build-Curl-Desktop_Qt_5_12_11_MinGW_32_bit-Debug\debug\Curl.exe ...
    11:54:25: The program has unexpectedly finished.
    11:54:25: The process was ended forcefully.
    11:54:25: D:\Workspaces\build-Curl-Desktop_Qt_5_12_11_MinGW_32_bit-Debug\debug\Curl.exe crashed.
    

    My .pro file:

    QT -= gui
    
    CONFIG += c++11 console
    CONFIG -= app_bundle
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    win32: LIBS += -L$$PWD/../libs/curl-7.64.0-win32-mingw/lib/ -lcurl
    
    INCLUDEPATH += $$PWD/../libs/curl-7.64.0-win32-mingw/include
    DEPENDPATH += $$PWD/../libs/curl-7.64.0-win32-mingw/include
    

    The main.cpp

    #include <QCoreApplication>
    #include <curl/curl.h>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        CURL *curl = curl_easy_init();
        curl_easy_cleanup(curl);
    
        return a.exec();
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you check that the curl dll can be loaded at run time by your application ?

      If not, either copy the dll in the build folder or add the path to the curl dll to the PATH environment variable in the Run part of the Project panel.

      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
      1
      • G Offline
        G Offline
        GeertDaelemans
        wrote on last edited by
        #3

        Everyday I get smarter and smarter... thanks, that did the trick! ;-)

        Btw do you know of any good resources that would help a newbie like me to get these external libraries explained? And how to package them correctly?

        Thank you very much,

        Geert

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The rules on Windows to avoid DLL hell are pretty simple:

          • Deploy the dlls your application requires in the same folder as your executable (plugins like Qt's own can live in different folders though).
          • Do NOT install any dll in system folders. This can have unexpected side effects and wreak havoc.
          • Unless really required (most of the time it's not), do not modify the PATH environment variable.

          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
          3

          • Login

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