cURL / Mailing Lists / curl-library / Single Mail

curl-library

Static linking with mingw without msys (7.29)

From: Andrew Clarkin <ajclarkin_at_gmail.com>
Date: Sun, 17 Feb 2013 16:49:51 +0000

Hi

I'd be grateful if anybody could help me out or tell me to stop if what I'm
attempting is not possible. I've not managed to answer my question with
google or the list archive.

I run mingw on windows 7 without msys. It usually works fine and I've
managed to compile and link successfully, including a bit of sockets
programming. I'm now trying to use libcurl to make my life easier.

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?

Many thanks for any advice offered.

Kind regards
Andrew

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-17