cURL / Mailing Lists / curl-library / Single Mail


Re[2]: Linker error, Dev-C++, Windows XP

From: <>
Date: Sun, 4 Feb 2007 10:44:06 +0100

>> I'm beginner. I tried to compile simple source code using libcurl. I
>> downloaded Dev-C++ and libcurl for Windows. I copied catalog 'curl',
>> which was in libcurl archive to 'Dev-C++\include'.
>> Must I do sth else?
>> Then I tried compile 'simple.c' which is in libcurl archive:
>> Compiler:
>> [Linker error] undefined reference to `_imp__curl_easy_init'
>> [Linker error] undefined reference to `_imp__curl_easy_setopt'
>> [Linker error] undefined reference to `_imp__curl_easy_perform'
>> [Linker error] undefined reference to `_imp__curl_easy_cleanup'
>> ld returned 1 exit status
>> Compile log:
>> Compiler: Default compiler
>> Executing gcc.exe...
>> gcc.exe "D:\Programy\libcurl-7.16.0\docs\examples\simple.c" -o "D:\Programy\libcurl-7.16.0\docs\examples\simple.exe" -I"C:\Dev\include" -L"C:\Dev\lib"
>> D:\DOCUME~1\Spearow\USTAWI~1\Temp/ccSSbaaa.o(.text+0x2b):simple.c: undefined reference to `_imp__curl_easy_init'
>> D:\DOCUME~1\Spearow\USTAWI~1\Temp/ccSSbaaa.o(.text+0x51):simple.c: undefined reference to `_imp__curl_easy_setopt'
>> D:\DOCUME~1\Spearow\USTAWI~1\Temp/ccSSbaaa.o(.text+0x5e):simple.c: undefined reference to `_imp__curl_easy_perform'
>> D:\DOCUME~1\Spearow\USTAWI~1\Temp/ccSSbaaa.o(.text+0x6e):simple.c: undefined reference to `_imp__curl_easy_cleanup'
>> collect2: ld returned 1 exit status
>> Execution terminated
>> I don't know what path is this:
>> 'D:\DOCUME~1\Spearow\USTAWI~1\Temp/ccSSbaaa.o'.
>> What I'm doing wrong?

> It seems that the linker is looking for the curl library. Before you
> can write curl programs, you have to compile curl itself so the
> libcurl library is available for curl programs to link with. Or make
> the library available to the program, for example if you have the
> libcurl library as a binary that came with another program in MinGW or
> Cygwin for example.

> James

Thanks for your answer :) I know now how do this, but it's not too
gcc -DCURL_STATICLIB -c -g -Icurl/include simple.c
gcc -o simple.exe simple.o -Lcurl/lib -lcurl -lws2_32 -lwinmm

Received on 2007-02-04