cURL - The program has unexpectedly finished. Crash!
-
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?
Adds for cURL in .pro file:
LIBS += -LC:\Users\xxx\Desktop\Dir\OpusC\curl-2\lib -lcurlINCLUDEPATH += 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;
-
Run with debugger attached (F5), it will show you where the crash occurs.
-
-
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.
-
-
https://slproweb.com/download/Win32OpenSSL-1_1_1g.exe I downloaded and resolved this problem thanks for your help.
-
https://slproweb.com/download/Win32OpenSSL-1_1_1g.exe I downloaded and resolved this problem thanks for your help.
@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!
-
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/.
-
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/.
@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.
-
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?
Adds for cURL in .pro file:
LIBS += -LC:\Users\xxx\Desktop\Dir\OpusC\curl-2\lib -lcurlINCLUDEPATH += 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;
@Hayden-Harber Did you get any solution for this. i have encountered the same problem like this.