Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old May 23rd, 2006, 02:45 PM
chiefbutz@gmail.com
Guest
 
Posts: n/a
Default Borland C++ 5.5.1, Uresolved External

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;
}"

  #2  
Old May 23rd, 2006, 02:55 PM
Ducky Yazy
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External


chiefbutz@gmail.com wrote:[color=blue]
> 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"
>[/color]

Have you link your app with the libcurl (libcurl.lib?) ?

  #3  
Old May 23rd, 2006, 03:05 PM
Chiefbutz
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External

I don't have a libcurl.lib file, it never came with anything I
downloaded.

  #4  
Old May 23rd, 2006, 03:25 PM
Ducky Yazy
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External

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 ????

  #5  
Old May 23rd, 2006, 04:15 PM
Eric Jensen
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External


<chiefbutz@gmail.com> skrev i en meddelelse
news:1148391851.857432.130050@y43g2000cwc.googlegr oups.com...[color=blue]
>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[/color]

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


  #6  
Old May 23rd, 2006, 06:25 PM
The Last Ottoman
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External

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.

  #7  
Old May 23rd, 2006, 07:25 PM
Chiefbutz
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External

I think I will listen to Eric... I think I got what he said..

  #8  
Old May 23rd, 2006, 07:35 PM
Chiefbutz
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External

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)

  #9  
Old May 23rd, 2006, 08:25 PM
Eric Jensen
Guest
 
Posts: n/a
Default Re: Borland C++ 5.5.1, Uresolved External


"Chiefbutz" <chiefbutz@gmail.com> wrote in message
news:1148408916.012671.163120@j73g2000cwa.googlegr oups.com...[color=blue]
> 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)[/color]

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


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles