Borland C++ 5.5.1, Uresolved External

Discussion in 'C++' started by chiefbutz@gmail.com, May 23, 2006.

  1. Guest

    I am trying to compile an app that uses the libcurl API. I have the
    files for that in the correct places. Then I compile I get the
    following:
    "Error: Unresolved ecternal '_curl_easy_init' refrenced from
    c:\C++\CURL.OBJ
    Error: Unresolved ecternal '_curl_easy_setopt' refrenced from
    c:\C++\CURL.OBJ
    Error: Unresolved ecternal '_curl_easy_perfrom' refrenced from
    c:\C++\CURL.OBJ
    Error: Unresolved ecternal '_curl_easy_cleanup' refrenced from
    c:\C++\CURL.OBJ"

    For now I am just testing to make sure I have the curl bit working, the
    file stuff will come into use later, so here is my code:

    "// basic file operations
    #include <iostream>
    #include <fstream>
    #include <curl/curl.h>
    using namespace std;

    int main () {
    // ofstream myfile;
    // myfile.open ("example.txt");
    // myfile << "Writing this to a file.\n";
    // myfile.close();
    CURL *curl;
    CURLcode res;
    curl = curl_easy_init();
    if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "google.com");
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
    cout << res;
    }
    return 0;
    }"
     
    , May 23, 2006
    #1
    1. Advertising

  2. Ducky Yazy Guest

    wrote:
    > I am trying to compile an app that uses the libcurl API. I have the
    > files for that in the correct places. Then I compile I get the
    > following:
    > "Error: Unresolved ecternal '_curl_easy_init' refrenced from
    > c:\C++\CURL.OBJ
    > Error: Unresolved ecternal '_curl_easy_setopt' refrenced from
    > c:\C++\CURL.OBJ
    > Error: Unresolved ecternal '_curl_easy_perfrom' refrenced from
    > c:\C++\CURL.OBJ
    > Error: Unresolved ecternal '_curl_easy_cleanup' refrenced from
    > c:\C++\CURL.OBJ"
    >


    Have you link your app with the libcurl (libcurl.lib?) ?
     
    Ducky Yazy, May 23, 2006
    #2
    1. Advertising

  3. Chiefbutz Guest

    I don't have a libcurl.lib file, it never came with anything I
    downloaded.
     
    Chiefbutz, May 23, 2006
    #3
  4. Ducky Yazy Guest

    So you don't have any definitions of libcurl APIs? You have only the
    "curl/curl.h" ?

    Maybe you can find something more from your download website, e.g.
    something like:
    curl.cpp ????
     
    Ducky Yazy, May 23, 2006
    #4
  5. Eric Jensen Guest

    <> skrev i en meddelelse
    news:...
    >I am trying to compile an app that uses the libcurl API. I have the
    > files for that in the correct places. Then I compile I get the
    > following:
    > "Error: Unresolved ecternal '_curl_easy_init' refrenced from


    There are a few things that can be the trouble here.

    libcurl ships as source code and is written in C.
    Normally you would compile it yourself as a link library or
    as a dynamic library. By default borland creates the .lib
    file toghether with the dll when compiled.
    In both cases you need to import the .lib file.

    If you downloaded a already compiled libcurl as dll.
    Then borland has a nice utility tool called implib.exe
    It can create the import library by reading the dll.

    e.g. implib libcurl.lib libcurl.dll

    In case its a static library compiled with a non borland compiler
    you can use the coff2omf.exe for converting .lib from coff format
    into omf format (borland linker uses omf not coff)

    If you added the libcurl C files into you cpp project and
    compiles it all into 1 .exe. The .c files will be compiled as C
    and .cpp files as c++. When accessing functions from the
    compiled c files (.obj) from c++ you need to use extern statement
    e.g.:

    extern "C" {
    #include "curl/curl.h"
    }

    //eric
     
    Eric Jensen, May 23, 2006
    #5
  6. I faced this error before,
    But it was because I called a function which I have not declared
    before...

    maybe it is just like that.
     
    The Last Ottoman, May 23, 2006
    #6
  7. Chiefbutz Guest

    I think I will listen to Eric... I think I got what he said..
     
    Chiefbutz, May 23, 2006
    #7
  8. Chiefbutz Guest

    OK, I have the .lib file, now how do I use that in my program? (I am
    newer to c++ incase you didn't guess)
     
    Chiefbutz, May 23, 2006
    #8
  9. Eric Jensen Guest

    "Chiefbutz" <> wrote in message
    news:...
    > OK, I have the .lib file, now how do I use that in my program? (I am
    > newer to c++ incase you didn't guess)


    In borland c++ builder simply just add it to the project like any other file
    and it will take care of the rest for you.

    Project meny->add file to project

    If you just use the command line tools the .lib file should be linked with
    ilink32.exe

    //eric
     
    Eric Jensen, May 23, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RHJpa3Vz?=

    Borland C++ to Visual Studio

    =?Utf-8?B?RHJpa3Vz?=, Jun 30, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    6,063
    Scott
    Aug 8, 2005
  2. Piotr Karwatka

    Conversion MS VS.NET 2003 - Borland C#Builder

    Piotr Karwatka, Dec 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    370
    Kevin Spencer
    Dec 15, 2004
  3. Scott Allen
    Replies:
    8
    Views:
    10,942
    Scott Allen
    May 2, 2004
  4. Replies:
    1
    Views:
    1,122
    SuperKoko
    Oct 2, 2006
  5. Mellow Crow
    Replies:
    6
    Views:
    419
    Richard Cornford
    Nov 4, 2005
Loading...

Share This Page