curl-library
install problem on windows and studio 2008
Date: Mon, 18 Apr 2011 14:45:23 -0400
Hi... I'm new to the forum, and hope very much someone can help....
I am attempting to install libcurl on windows, using Visual Studio
2008 professional.
I have downloaded multiple instances of libcurl. The second version
was more promising,
but I get stuck on connot open curllib.dll.
Here are my steps and results:
*********************************************************************************************
I tried curl-7-21.4.
I clicked on the solution vc6curl.sln and click on build for libcurl.
It goes through and builds all the of the .c files... The result output says:
I get 1 warning:
transfer.c
.\transfer.c(553) : warning C4244: 'function' : conversion from
'time_t' to 'long', possible loss of data
Then the final output:
Generating Code...
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
Creating library DLL-Debug/libcurld_imp.lib and object
DLL-Debug/libcurld_imp.exp
Embedding manifest...
Build log was saved at
"file://c:\CPS271\CPS271_Library\curl-7.21.4\lib\DLL-Debug\BuildLog.htm"
libcurl - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
I then go to: curl-7.21.4/lib/DLL-Debug and do not find any
references to libcurl.dll.
I only find libcurl.res.
*********************************************************************************************
I then downloaded: libcurl-7.19.3-win32-ssl-msvc.zip which unzipped
provided the curllib.dll
Then under Studio I go project properties, linker, input and put in curllib.dll
under c/c++/general I add the include and lib paths
Under tools/options/vc++directories, i add the include and lib paths
When I go to build the solution, I get an error:
fatal error LNK1104: cannot open file 'curllib.dll'
*********************************************************************************************
Here is the demo program:
/*
* This is a very simple example of how to use libcurl from within
* a C++ program. The basic idea is that you want to retrieve the
* contents of a web page as a string. Obviously, you can replace
* the buffer object with anything you want and adjust elsewhere
* accordingly.
*
* Hope you find it useful..
*
* Todd Papaioannou
*/
*********************************************************************************************
#include <string>
#include <iostream>
#include <curl/curl.h>
using namespace std;
// Write any errors in here
static char errorBuffer[CURL_ERROR_SIZE];
// Write all expected data in here
static string buffer;
// This is the writer call back function used by curl
static int writer(char *data, size_t size, size_t nmemb,
std::string *buffer)
{
// What we will return
int result = 0;
// Is there anything in the buffer?
if (buffer != NULL)
{
// Append the data to the buffer
buffer->append(data, size * nmemb);
// How much did we write?
result = size * nmemb;
}
return result;
}
// You know what this does..
void usage()
{
cout << "curltest: \n" << endl;
cout << " Usage: curltest url\n" << endl;
}
/*
* The old favorite
*/
int main(int argc, char* argv[])
{
if (argc > 1)
{
string url(argv[1]);
cout << "Retrieving " << url << endl;
// Our curl objects
CURL *curl;
CURLcode result;
// Create our curl handle
curl = curl_easy_init();
if (curl)
{
// Now set up all of the curl options
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
// Attempt to retrieve the remote page
result = curl_easy_perform(curl);
// Always cleanup
curl_easy_cleanup(curl);
// Did we succeed?
if (result == CURLE_OK)
{
cout << buffer << "\n";
exit(0);
}
else
{
cout << "Error: [" << result << "] - " << errorBuffer;
exit(-1);
}
}
}
}
*********************************************************************************************
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-18