By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,079 Members | 901 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,079 IT Pros & Developers. It's quick & easy.

Borland C++ 5.5.1, Uresolved External

P: n/a
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 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a

ch*******@gmail.com 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?) ?

May 23 '06 #2

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

May 23 '06 #3

P: n/a
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 ????

May 23 '06 #4

P: n/a

<ch*******@gmail.com> skrev i en meddelelse
news:11**********************@y43g2000cwc.googlegr oups.com...
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
May 23 '06 #5

P: n/a
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.

May 23 '06 #6

P: n/a
I think I will listen to Eric... I think I got what he said..

May 23 '06 #7

P: n/a
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)

May 23 '06 #8

P: n/a

"Chiefbutz" <ch*******@gmail.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
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
May 23 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.