cURL / Mailing Lists / curl-library / Single Mail


cannot link to libcurl under cygwin

From: Chris Scaffidi <>
Date: Mon, 23 May 2005 13:59:26 -0400

I have had no success linking libcurl to a simple test application. The
linker keeps telling me that it cannot resolve references.
 I am using the -l and -L options. Perhaps I am not using them properly?
 Any help that you can provide would be deeply appreciated.
  Steps to reproduce:
 - Downloaded Cygwin and installed at c:\cygwin on my Windows XP system.
 - Downloaded latest cygwin libcurl "devel" distribution
 - Unzipped, placing the provided "lib" and "include" files into the cygwin
distribution. This yielded
  c:\cygwin\lib\libcurl.a c:\cygwin\lib\libcurl.dll.a c:\cygwin\lib\

 c:\cygwin\include\curl\curl.h c:\cygwin\include\curl\easy.h
c:\cygwin\include\curl\multi.h c:\cygwin\include\curl\stdcheaders.h
 - Used the "simple" example provided in the cygwin distribution and called
it ""
#include <curl/curl.h>

#include <stdio.h>


static int fn_append(char * data, size_t item_size, size_t item_count,

string* buffer) {

if (buffer == NULL) return 0;

buffer->append(data, item_size*item_count);

return item_size*item_count;



#include <stdio.h>

#include <curl/curl.h>

int main(void)


CURL *curl;

CURLcode res;

curl = curl_easy_init();

if(curl) {

curl_easy_setopt(curl, CURLOPT_URL, " <>");

res = curl_easy_perform(curl);

/* always cleanup */



return 0;


  - Finally, went to the command line and tried compiling:

 gcc -lcurl -L/cygwin/usr/lib

Here's what keeps coming back:

undefined reference to `
undefined reference to `
undefined reference to `
undefined reference to `
collect2: ld returned 1 exit status

  I have tried using MinGW instead (with the corresponding libcurl
distribution) and got essentially the same error. If I change the "-lcurl"
command to "-lcurlgarbage", then the linker rightly complains that it cannot
find the archive; so I infer that it is indeed successfully finding the
archive, but is simply choosing not to use it. Please help!!!
Received on 2005-05-23