cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl with Codeblocks

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 6 May 2016 15:39:09 -0400

On 5/6/2016 2:23 PM, as df wrote:
> curl = curl_easy_init();
>
> isn't an error anymore but now I get this error:
>
> C:\...\curl-7.48.0-win64-mingw\lib\libcurl.a(easy.o)|| undefined
> reference to `__imp_WSAStartup'|
>
> In the lib folder there are 2 files: libcurl.a and libcurldll.a
>
> I use Win10 64 bit and tried this code:
> https://curl.haxx.se/libcurl/c/simple.html.
>
> SOLVED: I had to link the libraries in the right order. First
> libcurldll.a , second libcurl.a
>
> However I still get an error: Program can not be started because
> libcurl.dll is missing. I have this file but don't know what to do
> with it. Could it be the case that I have to set a PATH variable in
> system properties? Would be glad if someone could explain this to me,
> guess you can mess up a lot there.

You only need one, libcurldll. curl-7.48.0-win32-mingw comes with both
the DLL import library (libcurldll.a) and the static library
(libcurl.a). Though it has a static library it is missing the other
static library dependencies so it won't be possible to use the static
library unless you have those dependencies. Remove libcurl.a from your
libs. What you may need to do is specify the lib directory and then the
lib curldll. Basically it looks something like this when I build it

gcc -o simple simple.c -I curl-7.48.0-win32-mingw\include -L
curl-7.48.0-win32-mingw\lib -lcurldll

And yes you need to have the DLL in your path or the same directory as
your program. Some IDEs have a project section where you can use a
modified path for running your program.

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-06