Installing curl and libcurl with Makefile.m32

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:

1
2
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <curl/curl.h>
#include <fstream>


using namespace std;

static size_t data_write(void* buf, size_t size, size_t nmemb, void* userp)
{
	if(userp)
	{
		std::ostream& os = *static_cast<std::ostream*>(userp);
		std::streamsize len = size * nmemb;
		if(os.write(static_cast<char*>(buf), len))
			return len;
	}

	return 0;
}

int main()
{
    CURLcode res;
    curl_global_init(CURL_GLOBAL_ALL);
    CURL *cURL;
    cURL = curl_easy_init();
    ofstream * pFile = new ofstream;
    pFile->open("Image.dat", ios::out);

    curl_easy_setopt( cURL, CURLOPT_URL, &data_write );
    curl_easy_setopt( cURL, CURLOPT_WRITEDATA, pFile );

    curl_global_cleanup();
    return 0;
}
You need to add libcurl.a to your linker import libraries. To run your program you also need libcurl.dll in working directory.
Please specify what do you mean by "working directory" .
Usually this means same folder as your main program executable, but if you launch your application from inside IDE it could be your project files directory.
Ok. Thanks a lot!!! At last got the file. However, I ran the program with libcurl.dll in working directory and without it. Worked in both cases. If you have any thoughts why is it so, I'm all eyes )))
Do you have libcurl.dll in C:\windows\system32 installed by another application or by you ?
Topic archived. No new replies allowed.