1

I have a Visual Studio 2012 C++ project. I installed libcurl by Right Clicking my project and selecting Manage NuGet Packages.

I am trying to run the following simple program:

#include <stdio.h>
#include <curl\curl.h>

int main(void)
{
    CURL *curl;
    CURLcode res;

    curl_global_init(CURL_GLOBAL_DEFAULT);

    curl = curl_easy_init();
    if(curl)
    {
        //I will do something
    }

  return 0;
}

When I run it I get the following error:

enter image description here

This solution: Calling any cURL function results in "entry point not found" when executing the program pointed me to this solution: Using the Windows 8 SDK to compile for Windows 7 which told me to change my Platform Toolset from Visual Studio 2012 (v110) to Visual Studio 2012 - Windows XP (v110_xp)

But I still get the same error.

Anyone know how to solve this?

Community
  • 1
  • 1
Harry Boy
  • 4,159
  • 17
  • 71
  • 122

1 Answers1

2

When building with Visual Studio 2012/2013 using the default "v110"/"v120" toolset you are using the Windows 8.x SDK. To support Windows 7, you just need to set a Preprocessor Define _WIN32_WINNT=0x0601 to indicate support for Windows 7 or later rather than the default 0x0602 or 0x0603 which indicates support for Windows 8 or later.

See MSDN

If you change to the "v110_xp"/"v120_xp" tooslet then you are using the Windows 7.1A SDK because the Windows 8.x SDK cannot support Windows XP. Here you should set _WIN32_WINNT to 0x0501 if you want Windows XP support. In general, you do not need to use the "v110_xp"/"v120_xp" toolset to target Windows 7.

The more basic problem here is that you are likely not building the cURL code at all since you are using NuGet.

First try setting the _WIN32_WINNT setting to see if the NuGet package was built to support down-level Win32 desktop applications. Otherwise, the NuGet was published with .libs built for Windows 8.x only compatibility--which is required BTW to use it in Windows Store apps rather than Win32 desktop apps. You can also try obtaining the library directly and building it yourself from the original project website http://curl.haxx.se/

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81