Thread: error: Id returned 5 exit status

  1. #1
    Registered User
    Join Date
    Mar 2018
    Posts
    12

    error: Id returned 5 exit status

    So I was making a simple cURL program to retrieve a string from a website. But, when I compile the program, the program returned this error: [Error] Id returned 5 exit status. I've included the cURL library in the project (libcurl.dll). Do you know how to fix this error? :/

    Here's the code:
    Code:
    using namespace std;
    #include <iostream>
    #include <string>
    #include "curl.h"
    
    /* run this program using the console pauser or add your own getch, system("pause") or input loop */
    
    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;
    }
    
    int main(int argc, char** argv) {
      CURL *curl;
      CURLcode res;
      string readBuffer;
    
      curl = curl_easy_init();
      if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "icanhazip.com");
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        cout << readBuffer << endl;
        return 0;
    }
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Which OS/compiler/IDE are you using?

    Does it know where to find the dll?

    Did you follow the library naming convention for your system?
    For example on linux, it would be
    gcc prog.c -lcurl
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2018
    Posts
    12
    Ah yeah, I'm using Windows 10 Pro 64bit, Dev-C++ as the IDE, and the compiler is MinGW. I've pointed the dll file in the linker.

  4. #4
    Registered User
    Join Date
    Mar 2018
    Posts
    12
    And I've tried to do what you said, nothing worked :/

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Mar 2018
    Posts
    12
    Quote Originally Posted by Salem View Post
    I've already added it to the project, and in the linker too :v

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error: ld returned 1 exit status
    By vead in forum C Programming
    Replies: 6
    Last Post: 01-19-2018, 11:38 AM
  2. [Error] Id returned 1 exit status
    By iyilikpenisi in forum C Programming
    Replies: 6
    Last Post: 09-16-2016, 02:28 PM
  3. collect2.exe: error: ld returned 1 exit status
    By umutefiloglu in forum C Programming
    Replies: 4
    Last Post: 05-11-2014, 09:37 AM
  4. collect2: ld returned 1 exit status error??
    By blindchicken11 in forum C Programming
    Replies: 11
    Last Post: 11-07-2011, 08:38 PM
  5. ERROR collect2: ld returned 1 exit status
    By meili100 in forum C++ Programming
    Replies: 13
    Last Post: 12-04-2007, 12:20 PM

Tags for this Thread