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. cURL - The program has unexpectedly finished. Crash!

cURL - The program has unexpectedly finished. Crash!

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 1.1k 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.
  • Hayden HarberH Offline
    Hayden HarberH Offline
    Hayden Harber
    wrote on last edited by
    #1

    Hello, I used cURL in my Qt project, but as you can see in the title I get an error. Full version: The program has unexpectedly finished.
    The process was ended forcefully.

    I could not fix this error. Can you please help me?

    0882797e-d0d6-489c-a291-b2a0094e9032-image.png

    Adds for cURL in .pro file:
    LIBS += -LC:\Users\xxx\Desktop\Dir\OpusC\curl-2\lib -lcurl

    INCLUDEPATH += C:/Users/xxx/Desktop/Dir/OpusC/curl-2/include

    and the codes I used in mainwindow.cpp:

    #define CURL_STATICLIB
    #include <curl/curl.h>

    static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp)
    {
    ((std::string*)userp)->append((char*)contents, size * nmemb);
    return size * nmemb;
    }

    CURL* curl;
    CURLcode res;
    std::string readBuffer;

    curl = curl_easy_init();
    if (curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
    res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    MessageBoxA(NULL, readBuffer.c_str(), "Test", NULL);
    //cout << readBuffer << std::endl;
    }

    cURL Screenshots;
    397d3d88-c227-4a75-8dac-42b1c8bfb6fa-image.png

    f5dfdded-3986-4b3f-a4b6-a545fd763b1d-image.png

    d8e13e7e-a089-4d32-b313-dceb6745816d-image.png

    D 1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Run with debugger attached (F5), it will show you where the crash occurs.

      (Z(:^

      1 Reply Last reply
      3
      • Hayden HarberH Offline
        Hayden HarberH Offline
        Hayden Harber
        wrote on last edited by
        #3

        b943fb20-d01c-45e2-a5e9-88eca6511dda-image.png

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

          Hi,

          Did you add the path to the folder containing the curl .dll file to the PATH environment variable in the Run part of the Project panel ?

          Or simply copy it in the build folder of your application.

          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
          2
          • Hayden HarberH Offline
            Hayden HarberH Offline
            Hayden Harber
            wrote on last edited by
            #5

            6cb2ce20-f67a-4cef-8c3d-5b4fbf78cd6e-image.png

            9af84c75-30d2-4476-b8c6-3c6983001c32-image.png

            1 Reply Last reply
            0
            • Hayden HarberH Offline
              Hayden HarberH Offline
              Hayden Harber
              wrote on last edited by
              #6

              https://slproweb.com/download/Win32OpenSSL-1_1_1g.exe I downloaded and resolved this problem thanks for your help.

              Pablo J. RoginaP 1 Reply Last reply
              1
              • Hayden HarberH Hayden Harber

                https://slproweb.com/download/Win32OpenSSL-1_1_1g.exe I downloaded and resolved this problem thanks for your help.

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #7

                @Hayden-Harber said in cURL - The program has unexpectedly finished. Crash!:

                I downloaded and resolved this problem thanks for your help

                great, so please don't forget to mark your post as solved!

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                1
                • Hayden HarberH Offline
                  Hayden HarberH Offline
                  Hayden Harber
                  wrote on last edited by
                  #8

                  Hello, everything is ok but HTTPS sites are not accessed without using a SIGNED certificate. Can you help me please? There is curl-ca-bundle.crt in the bin folder, but it probably doesn't use it. What is the solution? https://medium.com/@farhabihelal/how-to-set-up-libcurl-on-visual-studio-2019-a9fdacce6945 I used the steps in this link in Visual Studio 2019 using SSL - HTTPS and not debugging from https://www.httpdebugger.com/.

                  Pablo J. RoginaP 1 Reply Last reply
                  0
                  • Hayden HarberH Hayden Harber

                    Hello, everything is ok but HTTPS sites are not accessed without using a SIGNED certificate. Can you help me please? There is curl-ca-bundle.crt in the bin folder, but it probably doesn't use it. What is the solution? https://medium.com/@farhabihelal/how-to-set-up-libcurl-on-visual-studio-2019-a9fdacce6945 I used the steps in this link in Visual Studio 2019 using SSL - HTTPS and not debugging from https://www.httpdebugger.com/.

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @Hayden-Harber said in cURL - The program has unexpectedly finished. Crash!:

                    not accessed without using a SIGNED certificate

                    Do you mean you cannot URLs using a self-signed certificate?
                    That's good from an information security standpoint, but uneasy for development purposes so you may want to look at this post.

                    There is curl-ca-bundle.crt in the bin folder, but it probably doesn't use it

                    You may want to look at the discussion in this issue.

                    BTW, all these things are proper from libcurl and not strictly related to Qt framework.

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    1
                    • Hayden HarberH Hayden Harber

                      Hello, I used cURL in my Qt project, but as you can see in the title I get an error. Full version: The program has unexpectedly finished.
                      The process was ended forcefully.

                      I could not fix this error. Can you please help me?

                      0882797e-d0d6-489c-a291-b2a0094e9032-image.png

                      Adds for cURL in .pro file:
                      LIBS += -LC:\Users\xxx\Desktop\Dir\OpusC\curl-2\lib -lcurl

                      INCLUDEPATH += C:/Users/xxx/Desktop/Dir/OpusC/curl-2/include

                      and the codes I used in mainwindow.cpp:

                      #define CURL_STATICLIB
                      #include <curl/curl.h>

                      static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp)
                      {
                      ((std::string*)userp)->append((char*)contents, size * nmemb);
                      return size * nmemb;
                      }

                      CURL* curl;
                      CURLcode res;
                      std::string readBuffer;

                      curl = curl_easy_init();
                      if (curl) {
                      curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
                      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
                      curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
                      res = curl_easy_perform(curl);
                      curl_easy_cleanup(curl);
                      MessageBoxA(NULL, readBuffer.c_str(), "Test", NULL);
                      //cout << readBuffer << std::endl;
                      }

                      cURL Screenshots;
                      397d3d88-c227-4a75-8dac-42b1c8bfb6fa-image.png

                      f5dfdded-3986-4b3f-a4b6-a545fd763b1d-image.png

                      d8e13e7e-a089-4d32-b313-dceb6745816d-image.png

                      D Offline
                      D Offline
                      dufrasen
                      wrote on last edited by
                      #10

                      @Hayden-Harber Did you get any solution for this. i have encountered the same problem like this.

                      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