My problems are more of porting a code to Windows, than the code itself. I need to download a file from a URL ( ) and store it in a local file.

I think I've screwed up the setting up of the libcurl libraries. I am using Visual Studio 2008 as my IDE.

I first downloaded the zipped file with the libraries. I downloaded the file from here:
The description on the libcurl site said:
"This package is type libcurl This is a pure binary libcurl package, possibly including header files and documentation, but without the command line tool and other cruft. If you want libcurl for a program that uses libcurl, this is most likely the package you want."
Which fits in to what I want to do.

In my Visual Studio options, I added the libcurl folder in the 'include' path. I also added the bin folder (with all the .dll files) to my 'libraries' path.

I ran the following code:

#include <iostream>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
using namespace std;
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) 
    size_t written = fwrite(ptr, size, nmemb, stream);
    return written;

int downloader(string url)
    CURL *curl;
    FILE *fp;
    curl = curl_easy_init();
    return 0;

However, when I build the code, I get the following linking error:

error LNK2001: unresolved external symbol __imp__curl_easy_init
fatal error LNK1120: 1 unresolved externals

So, I next went and added all the dll's in the bin folder in the dependencies (Properties -> Linker -> Input-> Additional Dependencies).
(I could not find .lib files anywhere.)

Now when I compile it, I get the following error:

\C:\Program Files\libcurl\bin\libcurl.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2B8

Any idea what's the problem?

> In my Visual Studio options
Well there's your problem!

You downloaded MinGW libraries, not Visual Studio libraries.

Try here http://curl.haxx.se/download.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.