curl / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 2 Dec 2016 00:29:11 -0500

On 12/1/2016 6:11 PM, Greg Saunders wrote:
> Wow! THANKS for taking the time for such a detailed explanation.
> That helped tremendously.
>
> I downloaded curl-7.51.0.zip from https://curl.haxx.se/download.html
> and it all worked beautifully. And I did need
>
> mingw32-make.exe mingw32 CFG=sspi-winssl
>
> so thanks for your forethought in that.
>
> I switched over to libcurl.a, and tried to add the CURL_STATICLIB
> compiler flag, but the .exe still requires libcurl.dll - is that expected?

Please stop top-posting it makes the conversation hard to follow [1].

No, that is not expected. I imagine you have some incorrect settings.
You should just have one compiler flags entry. I would delete the two
you have and start from scratch. There could be instructions on the
internet that contradict this but here's what worked for me in Code::Blocks:

Build options > Compiler settings > Compiler Flags > New Flag:

Name: curl static
Compiler flags: -DCURL_STATICLIB
Linker flags: -lcurl -lcrypt32 -lwldap32 -lws2_32
Leave everything else as the default

Build options > Linker settings: There should be no curl entry in 'Link
libraries'

Build options > Search directories > Compiler: C:\foo\curl-7.51.0\include

Build options > Search directories > Linker: C:\foo\curl-7.51.0\lib

Now when you build if you look at the verbose output in the build log it
should look like this:

mingw32-gcc.exe -Wall -DCURL_STATICLIB -g -IC:\foo\curl-7.51.0\include
-c C:\foo\testproj\Test\main.c -o obj\Debug\main.o
mingw32-g++.exe -LC:\foo\curl-7.51.0\lib -o bin\Debug\Test.exe
obj\Debug\main.o -lcurl -lcrypt32 -lwldap32 -lws2_32

If it still won't work then include the build log output in your reply.

[1]: https://curl.haxx.se/mail/etiquette.html#Do_Not_Top_Post

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