cURL / Mailing Lists / curl-library / Single Mail


Re: Static linking with mingw without msys (7.29)

From: Guenter <>
Date: Mon, 18 Feb 2013 02:24:26 +0100

Am 17.02.2013 17:49, schrieb Andrew Clarkin:
> I have downloaded curl-7.29.0-devel-mingw32 zipfile, unpacked it and
> moved the contents to my mingw folder. I have done nothing else during
> installation as I cannot see anything else that is mentioned in the
> documentation that would work and some of the files mentioned do not
> seem to be included in the current release. (Cannot see how to use
> mingw32-make for installation and configure not an option.)
> As a test I have then tried to compile curl\samples\simple.c
> gcc -o simple.exe simple.c -I..\include -L..\lib -lcurldll
> This works fine and produces an executable. When executed I am prompted
> for libcurl.dll and once I add curl\bin to my system path the exectuable
> runs fine. So far so good.
> However, I want to link simple.c statically so that I don't require
> libcurl.dll
> gcc -o simple.exe simple.c -DCURL_STATICLIB -I..\include -L..\lib -lcurl
> This generates mutiple "undefined reference" errors. I have also tried
> linking other libraries as suggested in various posts and web pages
> (such as ws2_32, winmm, z) but to no avail and I'm now struggling.
> Can anybody please help? I feel I should be able to link statically
> since I can link dynamically. In particular:
> Is static linking possible without using msys?
> Is static linking possible using the setup I have (without building
> libcurl myself)?
> Am I missing something?
yes, the makefiles in ./samples folder ... ;-)
the issue you see is most likely that you didnt add the other bunch of
dependency libs since this version is build with almost everything -
hence it depends on openssl, libssh2, libidn, zlib ...
just set a path to your MinGW\bin folder and then just try inside the
samples dir 'mingw32-make' - that should build the samples and link them
statically; if not please post exact error output here ...


List admin:
Received on 2013-02-18