cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: help whith curllib

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 19 Dec 2000 23:59:40 +0100 (MET)

On Tue, 19 Dec 2000, Jon_at_usasn.com wrote:

(CC'ed to the mailing list for archiving and general knowledge.)

> You don't happen to have a example with a make file that works, to
> compile your sample program "simple.c" or maybe a command line, I am
> using mandrake 7.2

It is really dead simple. First I've built and installed curl (and libcurl).
Then I could:

% cd curl/docs/examples
% gcc -o simple simple.c -lcurl

Done.

This probably works because /usr/local/include seems to be in my compiler's
default path to look for include files and /usr/local/lib for libraries. If
they aren't for you, you might need:

% gcc -o simple -I/usr/local/include simple.c -L/usr/local/lib/ -lcurl

Now, when you want to run the program 'simple' it might say:

% ./simple
./simple: error in loading shared libraries: libcurl.so.0: cannot open shared
object file: No such file or directory

And that is because /usr/local/lib is not in my LD_LIBRARY_PATH. You can fix
that with:

% LD_LIBRARY_PATH="/usr/lib:/usr/local/lib"
% export LD_LIBRARY_PATH
% ./simple

(this example shows bash syntax, that LD-path should be placed in a startup
script somewhere)

You can also build the executable with a staticly set directory in which to
look for the library. Like:

% gcc -o simple simple.c -L/usr/local/lib/ -Wl,-rpath,/usr/local/lib/ -lcurl

... then you don't need the LD_LIBRARY_PATH stuff.

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on 2000-12-20