cURL / Mailing Lists / curl-library / Single Mail

curl-library

vc++ still having problems

From: JB <curl_at_itpsg.com>
Date: Thu, 1 Sep 2005 17:39:39 -0600

Sorry, me again...thnx for taking time to read.

I have used curl binaries under linux for several years now and always been
very happy with it. Again, thank you to all those who've contributed. But
I have to say, I've been at this for a many days now and I am about to
abandon libcurl and find an alternative. I have never had this much trouble
getting a 3rd party lib into one of my projects.

Out of the box, the curl.exe does not even compile clean. nmake with any of
the targets that link curl.exe always fail with at least four unresolved
symbols starting with __imp__. The snapshot yeilds same results as released
version. I think that is great that there lots of windows users out there
using this but I am guessing the vast majority is using the dll. However, I
need the static lib and having a hell of a time getting it to work. If it's
on my end, ok, but someone somewhere must have an idea of what I am doing
wrong? I have even followed several documents and articles I've found on
the net also with no luck.

I am changing to lib directory and running nmake -f Makefile.vc6
cfg=debug-ssl
I've also tried the curllib.lib generated by the .dsw project (except
configuring it for static lib instead of dll) with no luck.

I created the simplest of simplest console applications consisting solely of
the code at bottom of this message and made sure it was configured to use
the same run time libs as the statically built libcurld.lib which appears to
be MSVCRTD.lib. Although I am still seeing:

warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use
/NODEFAULTLIB:library

I still get many many of these:
libcurld.lib(easy.obj) : error LNK2019: unresolved external symbol
__imp__WSACleanup_at_0 referenced in function _name-your-favorite-one
_name-your-favorite-one just means the function names vary...

code from console app:

#include "stdafx.h"
#include <curl/curl.h>
#include <iostream>
#include <string>

CURL *curl;
CURLcode res;
char errorBuffer[CURL_ERROR_SIZE];
std::string buffer;

int _tmain(int argc, _TCHAR* argv[])
{

 curl_global_init(CURL_GLOBAL_WIN32 | CURL_GLOBAL_SSL);

 curl = curl_easy_init();
 if (curl)
 {
  res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
  if (res != CURLE_OK)
  {
   std::cout << "setopt: CURLOPT_WRITEDATA failed\n";
  }
  res = curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com/");
  if (res != CURLE_OK)
  {
   std::cout << "setopt: CURLOPT_URL failed\n";
  }
  res = curl_easy_perform(curl);
  if (res != CURLE_OK)
  {
   std::cout << "perform failed!\n";
  }
  curl_easy_cleanup(curl);
 } else {
  std::cout << "Apparently curl failed to initialize...\n";
 }
 curl_global_cleanup();
 return 0;
}
Received on 2005-09-02