Implementing libcurl: Difference between revisions
Jump to navigation
Jump to search
Note:Remember that you will need to repeat steps 8-10 in both Release and Debug configurations.
TomEdwards (talk | contribs) (correction, simplification) |
|||
Line 1: | Line 1: | ||
{{toc-right}} | |||
[http://curl.haxx.se/libcurl/ libcurl] is a free | '''[http://curl.haxx.se/libcurl/ libcurl]''' is a free library that can download data from the internet. It supports just about every protocol imaginable, and is available [http://curl.haxx.se/docs/copyright.html under a MIT/X derivative license]. | ||
== Implementation == | |||
== | === Windows === | ||
# [http://curl.haxx.se/latest.cgi?curl=zip Download the latest version of libcurl.] | |||
# Extract the <code>\lib</code> and <code>\include</code> folders to a convenient location. | |||
# Open libcurl's VS project and change it to Release mode. | |||
# Go to ''libcurl > Properties > C/C++ > Preprocessor > Definitions'' and add <code title="The official docs say -DCURL_STATICLIB...they are wrong!">CURL_STATICLIB</code>. Unless you really do want to use [[wikipedia:LDAP|LDAP]], and <code>HTTP_ONLY</code> too. | |||
# Go to ''libcurl > Properties > C/C++ > Code Generation > Runtime Library'' and change it to read <code>Multi-threaded (/MT)</code>. | |||
# '''Build libcurl.''' | |||
# Add <code>libcurl.lib</code> to your main project. The easiest way is to drag it onto the Solution Explorer. | |||
# Go to ''Your Project > Properties > C/C++ > Preprocessor > Definitions'' and add <code title="The official docs say -DCURL_STATICLIB...they are wrong!">CURL_STATICLIB</code>, as you did to curl itself. | |||
# Go to ''Your Project > Linker > Input > Additional Dependencies'' and add <code>ws2_32.lib</code>. If you want to use LDAP, add <code>wldap32.lib</code> as well. | |||
# Go to ''Your Project > Properties > C/C++ > General > Additional Include Directories'' and add the libcurl <code>\include</code> folder you extracted earlier. | |||
# <code>#include "curl/curl.h"</code> and start coding! <code>curl/easy.h</code> is helpful too. | |||
{{note|Remember that you will need to repeat steps 8-10 in both Release and Debug configurations.}} | |||
=== Linux === | |||
{{todo}} | |||
== Usage == | |||
== | |||
* [http://curl.haxx.se/libcurl/c/ The libcurl C API] | |||
* [http://curl.haxx.se/libcurl/c/example.html Some examples] | |||
[[Category:Programming]] | [[Category:Programming]] | ||
[[Category:Free source code]] | [[Category:Free source code]] |
Revision as of 06:58, 6 September 2010
libcurl is a free library that can download data from the internet. It supports just about every protocol imaginable, and is available under a MIT/X derivative license.
Implementation
Windows
- Download the latest version of libcurl.
- Extract the
\lib
and\include
folders to a convenient location. - Open libcurl's VS project and change it to Release mode.
- Go to libcurl > Properties > C/C++ > Preprocessor > Definitions and add
CURL_STATICLIB
. Unless you really do want to use LDAP, andHTTP_ONLY
too. - Go to libcurl > Properties > C/C++ > Code Generation > Runtime Library and change it to read
Multi-threaded (/MT)
. - Build libcurl.
- Add
libcurl.lib
to your main project. The easiest way is to drag it onto the Solution Explorer. - Go to Your Project > Properties > C/C++ > Preprocessor > Definitions and add
CURL_STATICLIB
, as you did to curl itself. - Go to Your Project > Linker > Input > Additional Dependencies and add
ws2_32.lib
. If you want to use LDAP, addwldap32.lib
as well. - Go to Your Project > Properties > C/C++ > General > Additional Include Directories and add the libcurl
\include
folder you extracted earlier. #include "curl/curl.h"
and start coding!curl/easy.h
is helpful too.

Linux
[Todo]