15 November 2012

LibCurl in Visual Studio 2010

cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. The libcurl library is free, thread-safe, IPv6 compatible, and fast. Bindings in more than 40 languages are available for libcurl, including C/C++, Java, PHP and Python.

You can directly download libCurl for windows built in Visual Studio 2010. You don't need to build it again. This library can be used in any visual studio 2010 project. Below are the steps to add it to your project.

  1. Download the library from the libCurl's site. If you want curl with SSL support, you can download it from here. If you want without SSL, you can download from here. These are the builds for 32 bit machines.
  2. Now create new VC++ project or open your old project.
  3. Go to Project Properties->Configuration Properties->VC++ Directories->Include Directories. Here add the libcurl's include folder of the extracted location. (E.g.- <extracted location>\libcurl-7.19.3-win32-ssl-msvc\include\curl\). Also add the directory above the curl folder i.e.  'libcurl-7.19.3-win32-ssl-msvc\include'as in some places, curl is included as include "curl/curlxxx.h".
  4. Now go to Linker->General->Additional Library Directories and add the location of curl library. If you have downloaded curl with SSL support, add the Debug directory containing curllib_static.lib, curllib.dll and curllib.lib. If you have downloaded curl without ssl support, just add the extracted location of curl containing the libcurl.lib file.
  5. Go to your Linker->Input->Additional Dependencies and add the library file to be linked i.e. libcurl.lib or curllib_static.lib, or curllib.lib.
  6.  You're done. Now add your code and compile it.

No comments:

Post a Comment