cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl.lib linking issues in MSVC 2005/ver 8

From: Wei Weng <wweng_at_kencast.com>
Date: Thu, 06 Dec 2007 12:12:13 -0500

Kevin Lawler wrote:
> Hello,
>
> I'm trying to create a version of libcurl.lib that I can include statically
> in a Windows program I'm writing. My end goal is to have all the
> libcurl+ssl+zlib functionality inside my Windows executable, so if there is
> an alternate way to accomplish what I'm thinking, I am open to suggestions.
> I am trying hard not to have accompanying dll files in my setup
> distribution. A precompiled working static libcurl.lib binary with
> up-to-date ssl+zlib functionality would be ideal, though I have not been
> able to find exactly that using a Google search, as each of the various
> hosted binaries seem to be incomplete or deficient in some way.
>
> So far I seem to have compiled the libcurl.lib successfully. When I try to
> link it inside my windows executable, a number of errors fire off. It looks
> like all the errors are related to ssl functions.
>
> This is the process I went through to create my libcurl.lib. First I
> downloaded the curl-7.17.1 source package. Then I downloaded openssl-0.9.8g.
> I put both of these directories at the root of the C: drive. To compile
> openssl I followed the direction in INSTALL.W32. First I installed
> ActivePerl. Then I loaded up a prompt, and from the
> C:\openssl-0.9.8gdirectory I ran
>
>
>> perl Configure VC-WIN32 --prefix=c:/openssl
>> ms\do_masm
>> nmake -f ms\nt.mak
>> nmake -f ms\nt.mak test
>> nmake -f ms\nt.mak install
>>
> [note nt.mak and not ntdll.mak, for the static version]
>
> Everything appeared to run fine without complaint. Both libeay32.lib and
> ssleay32.lib showed up in C:\openssl-0.9.8g\out32.
>
> Then I followed the Win32->'MSVC from command line' instructions in
> libcurl's INSTALL file. I ran my corresponding vcvars32.bat, and set my path
> using set OPENSSL_PATH=c:\openssl-0.9.8g (Note my 'g' where the help file
> has 'e'. Also, I would later try this with a forward slash, as the output at
> the end of the compile process has mismatching slashes. The version shown is
> taken directly from the INSTALL file.) Then I ran 'nmake vc' and 'nmake
> vc-ssl'.
>
> The end of that output looks something like this (I have run it multiple
> times, and it appears to change each time. This is what it looks like
> currently.) :
>
> link.exe /incremental:no /libpath:"../lib" /nologo /out:curl.exe/subsys
> tem:console /machine:X86 /LIBPATH:"c:/openssl-0.9.8g/out32" libcurl.lib
> libeay3
> 2.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib wsock32.lib wldap32.libwin
> mm.lib hugehelpr.obj writeoutr.obj urlglobr.obj getpassr.obj
> homedirr.obj c
> urlutilr.obj strtoofftr.obj mainr.obj curlr.res
>
> I then copy the libcurl.lib file from C:\curl-7.17.1\lib\release-ssl to the
> root directory of my windows project. I have it set to include
> libcurl.liband ws2_32.lib in Project->Properties->Configuration
> Properties->Linker->Input : Additional Dependencies.
>
> I also have C:\curl-7.17.1\include listed in my 'Additional Include'
> directories. At the beginning of the source file I have
>
> #include <curl/curl.h>
>
> and I have variously defined CURL_STATICLIB using
>
> #define CURL_STATICLIB
>
> at the beginning of the source file and
>
> -DCURL_STATICLIB
>
>
[SNIP]

I am not sure if this helps or not, but you should use /DCURL_STATICLIB
instead of the -D.

Wei
Received on 2007-12-06