cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: i cant link the library to my project

From: Alessandro Vesely <vesely_at_tana.it>
Date: Sun, 09 Mar 2008 11:30:41 +0100

shadow wrote:
> i compiled now the lib from the source, and put in the compile #defines
> of codeblocks the -DCURL_STATICLIB flag (when i press ok, it's converted
> to CURL_STATICLIB it's the same? )

Yep, -D is a [pre]compiler switch that accepts a macro *D*efinition,
which works as if you had a "#define CURL_STATICLIB" early in the
source files. Codeblocks may display just the macro name, but actual
command lines obviously need the -D switch.

The curl library has a large number of macro definitions, some of them
are automatically generated by the compiler (can check with cpp -dM),
other ones can be defined in header files (e.g. setup.h) during the
configuration process, still more can be defined on command lines,
i.e. either in the IDE or in makefiles. In any case, the effect of
macros is determined by the way they are used in the source code.

The linking process is somewhat more arcane. Make sure you fully
understand the difference between static and dynamic linking and can
discern apparently static libraries that are actually "import
libraries"; having those _imp__ prefixes is a win32 technique for
linking at runtime. Check what options you set in codeblocks, and
verify that it generates the link commands you expect.

> now i dont have the same errors than before when linking, now i have this:
>
> C:\curl-7.18.0\lib/libcurl.a(sslgen.o):(.text+0x736): undefined
> reference to `SSL_pending'

That is obviously a reference to an openssl function. You need the
openssl (or equivalent) library to run encrypted connections.

> it's going to be very appreciate if any can help me to use libcurl with
> my app.

It is easier to build the library using the provided makefiles, i.e.
invoking make from the command line. You may want to save the
resulting commands in order to check they match with the ones issued
by the IDE, in case you then redo the build in codeblocks (e.g. in
order to walk through the functions at runtime using the debugger.)
Received on 2008-03-09