Which Curl package for Windows 7 64 bit?

I am also a beginner but when I searched 'Curl' it brought this forum. I used Java, as an amateur, for several years but want to learn c++.

I have Windows 7 Home Premium 64 bit, with Visual Studio 2010 Express.

I downloaded the following using the Curl 'Download Wizard': curl-7.33.0-devel-mingw64, libcurl4-7.33.0-1.tar and curl-7.34.0. I suspect the first two were mistakes, as I do not really know what MingW or Cygwin are, but I don't think I have them. The second package gave me a .dll named 'Cygwin-4'.

I have googled, experimented ad infinitum. I have added include libraries, additional libraries (in Visual Studio), added Additional Dependencies, trying with various .dlls I found in my various packages......I now suspect I have not even downloaded the correct package.

The last one curl-7.34.0 has source code which I managed to build in Visual Studio. But it only gives me a libcurl.lib file, and it appears I need a libcurl.dll? I have .dlls in other packages, but suspect they are not appropriate.

My question basically is: have I downloaded the right package (curl-7.34.0) to build on my system (the Curl download page is very confusing)? And if I have, how do I get the .dll (and do I need it?)?

I also double-clicked Makefile.vc10 in the source package src folder, tried to build in Visual Studio (hoping against hope it might give me a .dll) but all it did was change the name of the file to Makefile without the .vc10 extension. I am desperate and seem to have reached the point where I don't know if I am coming or going.........

I assure you I have googled this extensively and also followed Using libcurl in Visual Studio by Rosso Salmanzadeh, a .pdf from 2002 which others assert is still basically valid.

Many thanks for any help.
Last edited on
Add CURL_STATICLIB prepocessoir directive if you want to build libcurl as a static library.
I tried that in one of the many combinations in Visual Studio. I have added the include directory from curl-7.34.0 (the built source code package), added the folder containing libcurl.lib in the Additional Libraries, and added libcurl.lib to the Additional Dependencies list.

I got the libcurl.dll from curl-7.33.0-devel-mingw64 and Cygwin-4.dll from libcurl4-7.33.0-1.tar - are they any good to me?

Should I be copying the .lib file from its location in the unzipped folder to another folder in my Visual Studio project? Do I need a more suitable .dll and where do I put that?

Thanks for your reply, I appreciate the help.
@modoran: are you sure? according to readme file, makefile handles this
nmake /f makefile.vc mode=static for building static lib
nmake /f makefile.vc mode=dll for building dll

EDIT:

I tried that in one of the many combinations in Visual Studio. I have added the include directory from curl-7.34.0 (the built source code package), added the folder containing libcurl.lib in the Additional Libraries, and added libcurl.lib to the Additional Dependencies list.
did your code compile without any errors?

I got the libcurl.dll from curl-7.33.0-devel-mingw64 and Cygwin-4.dll from libcurl4-7.33.0-1.tar - are they any good to me?
probably not. Those .dlls were compiled with mingw and I'm not sure if they work with visual studio. I gues that you might not need any .dll at all
Last edited on
I always build libcurl using Cmake, not by VS project.
thanks for your reply.

I got plenty of errors! I am afraid to say I have deleted all my attempts at creating curl projects, I had that many unsuccessful ones, I did not know what I had tried on each. The most common error I got - I have been trying to build simple.c, the example included in curl packages - was (something like) imp_curl_easy_setopt was an unresolved external dependency - and I got that error for each of the 'easy' functions.

I just opened the Makefile.vc10 in Visual Studio and tried to build - can you explain Cmake to me? and is your code above all I would need?

(sorry, I just realised there are two replies - thank you to both of you)
I have done the following, trying to incorporate what I have been told along the way:

Created new project in Visual Studio (empty project, character set not set).

Added the path to the package include directory (contains folder 'curl').

Added the path to the libcurl.lib file that building in Visual Studio appeared to create in Linker/Additional Library Directories.

Added 'libcurl.lib' to Linker/Additional Dependencies (but where do I put the actual file??? - just leave it in its home directory (in curl package)?)

added CURL_STATICLIB to Preprocessor list

this is what a build attempt produces (my original errors were only about 6 lines!):

1>------ Build started: Project: curlplus, Configuration: Debug Win32 ------
1> Creating library C:\Users\ant\Documents\Visual Studio 2010\Projects\curlplus\Debug\curlplus.lib and object C:\Users\ant\Documents\Visual Studio 2010\Projects\curlplus\Debug\curlplus.exp
1>libcurl.lib(easy.obj) : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _win32_init
1>libcurl.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__WSACleanup@0
1>libcurl.lib(easy.obj) : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _win32_init
1>libcurl.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__WSAStartup@8
1>libcurl.lib(select.obj) : error LNK2019: unresolved external symbol __imp__WSASetLastError@4 referenced in function _Curl_wait_ms
1>libcurl.lib(connect.obj) : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
1>libcurl.lib(curl_addrinfo.obj) : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
1>libcurl.lib(select.obj) : error LNK2019: unresolved external symbol ___WSAFDIsSet@8 referenced in function _Curl_socket_check
1>libcurl.lib(tftp.obj) : error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function _tftp_connect_for_rx
1>libcurl.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libcurl.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libcurl.lib(select.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libcurl.lib(asyn-thread.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libcurl.lib(sendf.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libcurl.lib(connect.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libcurl.lib(select.obj) : error LNK2019: unresolved external symbol __imp__select@20 referenced in function _Curl_socket_check
1>libcurl.lib(sendf.obj) : error LNK2019: unresolved external symbol __imp__send@16 referenced in function _Curl_send_plain
1>libcurl.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__send@16
1>libcurl.lib(sendf.obj) : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function _Curl_recv_plain
1>libcurl.lib(connect.obj) : error LNK2001: unresolved external symbol __imp__recv@16
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__getsockname@12 referenced in function _Curl_updateconninfo
1>libcurl.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__getsockname@12
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__getpeername@12 referenced in function _Curl_updateconninfo
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function _getaddressinfo
1>libcurl.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__ntohs@4
1>libcurl.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__ntohs@4
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__getsockopt@20 referenced in function _verifyconnect
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function _Curl_sndbufset
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function _singleipconnect
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__WSAIoctl@36 referenced in function _tcpkeepalive
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__bind@12 referenced in function _bindlocal
1>libcurl.lib(tftp.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libcurl.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function _bindlocal
1>libcurl.lib(curl_addrinfo.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libcurl.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libcurl.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function _Curl_closesocket
1>libcurl.lib(connect.obj) : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function _Curl_socket
1>libcurl.lib(curl_addrinfo.obj) : error LNK2019: unresolved external symbol __imp__freeaddrinfo@4 referenced in function _Curl_getaddrinfo_ex
1>libcurl.lib(curl_addrinfo.obj) : error LNK2019: unresolved external symbol __imp__getaddrinfo@16 referenced in function _Curl_getaddrinfo_ex
1>libcurl.lib(tftp.obj) : error LNK2019: unresolved external symbol __imp__sendto@24 referenced in function _tftp_send_first
1>libcurl.lib(tftp.obj) : error LNK2019: unresolved external symbol __imp__recvfrom@24 referenced in function _tftp_receive_packet
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ber_free referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_memfree referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_value_free_len referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_get_values_len referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_next_attribute referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_first_attribute referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_get_dn referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_next_entry referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_first_entry referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_search_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_simple_bind_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_init referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_set_option referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_err2string referenced in function _Curl_ldap
1>C:\Users\ant\Documents\Visual Studio 2010

(had to omit here, too many characters in my post)

Projects\curlplus\Debug\curlplus.exe : fatal error LNK1120: 43 unresolved externals
Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
the file I have been trying to build is simple.c:

#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, "http://example.com");
/* example.com is redirected, so we tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));

/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}

I should be able to build a C file shouldn't I?
Add "ws2_32.lib" to linker dependencies list. It sems that linker can't find functions from windows sockets library
thanks for that, I added that.

now I only have 16 unresolved externals! at least going in the right direction!

should I be placing libcurl.lib anywhere special? I have added it to the project (don't know whether I should have), but the path I have put in Linker/Additional Library Directories is to its home in my unzipped curl folder.

1>------ Build started: Project: curlplus, Configuration: Debug Win32 ------
1> Creating library C:\Users\ant\Documents\Visual Studio 2010\Projects\curlplus\Debug\curlplus.lib and object C:\Users\ant\Documents\Visual Studio 2010\Projects\curlplus\Debug\curlplus.exp
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ber_free referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_memfree referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_value_free_len referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_get_values_len referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_next_attribute referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_first_attribute referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_get_dn referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_next_entry referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_first_entry referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_search_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_simple_bind_s referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_init referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_set_option referenced in function _Curl_ldap
1>libcurl.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_err2string referenced in function _Curl_ldap
1>C:\Users\ant\Documents\Visual Studio 2010\Projects\curlplus\Debug\curlplus.exe : fatal error LNK1120: 16 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
add Wldap32.lib. Just google for function name (as I did for ldap_unbind_s) and you will quickly find in which library the function is stored.
Last edited on
I think you are a genius............

it built successfully. unfortunately it is written in C, so how do I get the console window to stay open when I run it to make sure it is opening the web page?



add system("pause") or std::cin.ignore( std::numeric_limits <std::streamsize> ::max(), '\n' ); at the end of main()
and read this: http://www.cplusplus.com/articles/iw6AC542/
Last edited on
I (think I) adapted the code to c++ and used cin.get()........the link you sent implies I should not have done this maybe, but never mind. THANK YOU for your help, I have been struggling with this for about 6 - 8 weeks! anyway it worked and thanks very much!

oops, just tried to build in release mode and got this error: >..\..\..\..\curl-7.34.0\curl-7.34.0\docs\examples\simple.cpp(23): fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory

worked fine in debug, opened code of web page

hi, you must be sick of this...........

I am going to mark this as being solved, because I think it is my stupidity.........if I switch to release mode, none of the changes I made to project properties are there, so I presume I just have to add them again, and it should work?

I will hold off marking this as solved a while longer in case I have not figured it right and you want to correct me.

then I will mark it as solved and thanks very very much!
I could build it in release mode, but when I ran it I got

'curlplus.exe': Loaded 'C:\Users\ant\Documents\Visual Studio 2010\Projects\curlplus\Release\curlplus.exe', Symbols loaded.
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Cannot find or open the PDB file
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'curlplus.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
First-chance exception at 0x77ace3be in curlplus.exe: 0xC0000005: Access violation reading location 0x667ab6ea.
Unhandled exception at 0x77ace3be in curlplus.exe: 0xC0000005: Access violation reading location 0x667ab6ea.
The program '[5192] curlplus.exe: Native' has exited with code -1073741819 (0xc0000005).
it only seems fair I mark this as solved.......curl is actually working, after so many weeks of trying! I will try and resolve the above error.......otherwise post a new question! but thanks once again!
Topic archived. No new replies allowed.