I try to install curl and libcurl.
So far I downloaded the curl-7.27.0.zip from http://curl.haxx.se,
unzipped it and compiled with MinGW32.
mingw32-make -C lib -f Makefile.m32
After this command a lot of file.o
files appeared in the folder, a libcurl.dll, libcurl.a.
To be honest I do not fully understand what the mingw32-make command does, but in despair I tried everything I found in the installation files from http://curl.haxx.se.
The compilation (I suppose that is what mingw32-make did) did not provide any header files and I'm confused what to #include. On all forums I've read everyone #include <curl/curl.h>. That is what I did as well. But when trying to use this header I get same mistakes:
D:\Dima\CodeBlocksProjects\Download2\main.cpp|24|undefined reference to `_imp__curl_global_init'
D:\Dima\CodeBlocksProjects\Download2\main.cpp|26|undefined reference to `_imp__curl_easy_init
and so on. They pop up at each line where curl is referenced.
I suppose I have to do some additional actions besides the "mingw32-make" to link library correctly. Where do I have to dig?
I've read all posts concerning curl on cplusplus.com, read the installation instructions from curl.haxx.se, read the tutorial on curl.haxx.se, but nevertheless I do not know what to do next.
I use Code::Blocks 10.5; OS Win7.
Please let me know if any additional information is required. Would be grateful for any help.
The code of my program is:
using namespace std;
static size_t data_write(void* buf, size_t size, size_t nmemb, void* userp)
std::ostream& os = *static_cast<std::ostream*>(userp);
std::streamsize len = size * nmemb;
cURL = curl_easy_init();
ofstream * pFile = new ofstream;
curl_easy_setopt( cURL, CURLOPT_URL, &data_write );
curl_easy_setopt( cURL, CURLOPT_WRITEDATA, pFile );