Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved cURL - The program has unexpectedly finished. Crash!

    General and Desktop
    5
    10
    479
    Loading More Posts
    • 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 Harber
      Hayden Harber last edited by

      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 Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

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

        (Z(:^

        1 Reply Last reply Reply Quote 3
        • Hayden Harber
          Hayden Harber last edited by

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

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 2
            • Hayden Harber
              Hayden Harber last edited by

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

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

              1 Reply Last reply Reply Quote 0
              • Hayden Harber
                Hayden Harber last edited by

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

                Pablo J. Rogina 1 Reply Last reply Reply Quote 1
                • Pablo J. Rogina
                  Pablo J. Rogina @Hayden Harber last edited by

                  @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 Reply Quote 1
                  • Hayden Harber
                    Hayden Harber last edited by

                    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. Rogina 1 Reply Last reply Reply Quote 0
                    • Pablo J. Rogina
                      Pablo J. Rogina @Hayden Harber last edited by

                      @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 Reply Quote 1
                      • D
                        dufrasen @Hayden Harber last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post