Hi,
I'm using C::B for my project in combination with MinGW. I've installed MinGW in C:\MinGW and everything is working well, untill I wanted to use libcurl (http://curl.haxx.se) for my project. I've compiled the code well, and everything is working from the command line.
In the commandline the following code works well:
gcc -o simple simple.c -DCURL_STATICLIB -I ..\..\include -L ..\..\lib\ -lcurl -lws2_32 -lwinmm
My libcurl map is in: C:\MinGW\libcurl
But in C::B, when I add the libcurl\includes to Search Directories compiler and libcurl\lib too the Search D. Linker, and libcurl.a, libcurldll.a, libws2_32.a and libwinmm.a to the linker itself I still have compiling errors:
zlib1.dll not found when I add libcurldll.a to the compiler and the following when I remove libcurlddl.a from the linker settings:
Compiling: C:\MinGW\src\tb\simple.c
Linking console executable: C:\MinGW\src\tb\simple.exe
C:\MinGW\src\tb\simple.o:simple.c:(.text+0x2b): undefined reference to `_imp__curl_easy_init'
C:\MinGW\src\tb\simple.o:simple.c:(.text+0x51): undefined reference to `_imp__curl_easy_setopt'
C:\MinGW\src\tb\simple.o:simple.c:(.text+0x5e): undefined reference to `_imp__curl_easy_perform'
C:\MinGW\src\tb\simple.o:simple.c:(.text+0x6e): undefined reference to `_imp__curl_easy_cleanup'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
4 errors, 0 warnings
How am I supposed to fix this?
With libcurldll.a linked:
mingw32-gcc.exe -IC:\MinGW\include -IC:\MinGW\libcurl\include -c C:\MinGW\src\tb\simple.c -o C:\MinGW\src\tb\simple.o
mingw32-g++.exe -LC:\MinGW\lib -LC:\MinGW\libcurl\lib -o C:\MinGW\src\tb\simple.exe C:\MinGW\src\tb\simple.o C:\MinGW\libcurl\lib\libcurl.a C:\MinGW\lib\libws2_32.a C:\MinGW\lib\libwinmm.a C:\MinGW\lib\libcurldll.a
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 0 warnings
Checking for existence: C:\MinGW\src\tb\simple.exe
Executing: C:\Program Files\CodeBlocks/cb_console_runner.exe "C:\MinGW\src\tb\simple.exe" (in C:\MinGW\src\tb)
Process terminated with status -1073741510 (0 minutes, 8 seconds)
Without libcurldll.a linked remains the same.
I know this is an old thread, but seeing that there are at list 2 people who didn't get a solution, I give my 2 cents:
- Go to "Project" -> "Build options..."
- Under "Compiler settings" select the "Other options" tab
- Add your options there as you would do in the command line, in your case it would be like this:
-DCURL_STATICLIB
-I ..\..\include
-L ..\..\lib\
-lcurl
-lws2_32
-lwinmm
Good luck!