curl / Mailing Lists / curl-library / Single Mail

curl-library

getting libcurl to run with C in codeblocks (mingw-32)

From: Greg Saunders <gmsaunders_at_gmail.com>
Date: Wed, 30 Nov 2016 10:39:46 -0600

I've spent a few hours trying to run libcurl in codeblocks (GNU GCC
mingw-32 Compiler), and I've searched through lots of help pages and
archives, but some information seems outdated or too general, and I'm
stuck. Here's what I did:

   1. downloaded curl from https://github.com/curl/curl
   2. ran buildconf.bat (successfully)
   3. created new C project in codeblocks (main.c)
   4. copied contents curl/docs/examples/url2file.c intro main.c for my
   test program
   5. Under "Project/Build Options/Search directories" I added relative
   path to "myCurlGitDownload\curl\include\" (the .h files).

When I tried to compile main.c I get:

*undefined reference to `_imp__curl_global_init'*

I searched for that error, which led me to
https://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur (5.7
Link errors when building libcurl on Windows!). It said to add

-DCURL_STATICLIB to your CFLAGS

which I tried, but either a did it incorrectly or it did not help.

Here is how I tried to set up the flag, though I confess I'm not really
sure what I'm doing at this point:

[image: Inline image 1]

I do not have any linked libraries - tried to do that too, but was not sure
exactly how to set it up.

Any help greatly appreciated!

Greg Saunders

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

image.png
Received on 2016-11-30