0


I want to compile libcurl with Borland C++. I make libcurl.lib by following code:

make borland

The lib file has made successfully. Now i want to build a test example. Something like this:

#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
    /* example.com is redirected, so we tell libcurl to follow redirection */
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);
    /* Check for errors */
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}

It compiles successfully. (The obj file has made.)
But it couldn't build. The following errors reported:

Error: Unresolved external 'InitializeCriticalSectionEx' referenced from C:\USERS\4L1R3Z4\DOWNLOADS\COMPRESSED\CURL\CURL\LIB\LIBCURL.LIB|asyn_thread
Error: Unresolved external 'GetTickCount64' referenced from C:\USERS\4L1R3Z4\DOWNLOADS\COMPRESSED\CURL\CURL\LIB\LIBCURL.LIB|timeval
Error: Unresolved external '__fstat' referenced from C:\USERS\4L1R3Z4\DOWNLOADS\COMPRESSED\CURL\CURL\LIB\LIBCURL.LIB|file

All libraries has added to Build configuration. My OS is : Windows 7 64Bit.

I really don't know what library should i add to fix this issue! Sincerely yours.

BiriBora
  • 43
  • 7
  • What version of Borland C++? BTW that is a very old compiler, a much better option would be to get a recent compiler. – M.M Aug 08 '15 at 09:01
  • @MattMcNabb : You are right. but i want use that. Version is : 5.02 – BiriBora Aug 08 '15 at 09:03
  • 1
    "Make libcurl in Borland C++ isn't successful" – exactly. Use a reasonably modern compiler. Why would you *want* to use Borland C++? – The Paramagnetic Croissant Aug 08 '15 at 09:06
  • 3
    The `InitializeCriticalSectionEx()` and `GetTickCount64()` functions did not exist when your version of Borland C++ was released, so they do not exist in its `kernel32.lib` import file. Use the command-line `implib` tool to create a new `kernel32.lib` from a modern version of `kernel32.dll`. As for `__fstat()`, I'm not sure what to do about that one. I'm not sure if that version even had `fstat()` yet. – Remy Lebeau Aug 08 '15 at 09:07
  • @RemyLebeau : Thanks. I make a kernel32.lib by this command: `implib /s kernel32.lib kernel32.dll` and then i import it to my libraries. But it couldn't fix my problem with InitializeCriticalSectionEx and GetTickCount64 – BiriBora Aug 08 '15 at 09:18
  • Alternatively, when compiling libcurl, make sure that `_WIN32_WINNT_VISTA` is not defined, and/or that `_WIN32_WINNT` as defined as a value less then `_WIN32_WINNT_VISTA` (0x0600). That should disable libcurl's use of `InitializeCriticialSectionEx()` and `GetTickCount64()`. – Remy Lebeau Aug 08 '15 at 09:18
  • @AlirezaHosseini: are you sure your projects are actually linking with your updated `kernel32.lib` and not the original? – Remy Lebeau Aug 08 '15 at 09:20
  • @RemyLebeau Yes. I add new kernel32.lib in my library files.. – BiriBora Aug 08 '15 at 09:25

0 Answers0