Here’s how I’ve got curl to work with Visual Studio 2017 15.9.14:
- Download curl zip package from https://curl.haxx.se/download.html (latest verified is: https://curl.haxx.se/download/curl-7.70.0.zip)
- Extract downloaded package to a folder of your choice (e.g.
C:\curl\
) - Open
Developer Command Prompt for VS 2017
(see Windows Start menu or%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\
) andcd
toC:\curl\winbuild\
- Run
nmake /f Makefile.vc mode=static
. This will build curl as a static library intoC:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\
- Create a new project in Visual Studio (e.g. a
Windows Console Application
) - In Project
Properties -> VC++ Directories -> Include Directories
addC:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\include\
- In Project
Properties -> VC++ Directories -> Library Directories
addC:\curl\builds\libcurl-vc-x86-release-static-ipv6-sspi-winssl\lib\
there - In Project
Properties -> Linker -> Input -> Additional Dependencies
addlibcurl_a.lib
,Ws2_32.lib
,Crypt32.lib
,Wldap32.lib
andNormaliz.lib
- Try to build a sample program:
#define CURL_STATICLIB
#include <curl\curl.h>
int main()
{
CURL *curl;
curl = curl_easy_init();
curl_easy_cleanup(curl);
return 0;
}
Alternatively you can use vcpkg to install curl:
- Get latest vcpkg zip file from https://github.com/microsoft/vcpkg/releases (e.g. https://github.com/microsoft/vcpkg/archive/2019.09.zip) and extract it to a folder of your choice (e.g. C:\vcpkg\)
- Open
Developer Command Prompt for VS 2017
(see Windows Start menu or%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\
) andcd
toC:\vcpkg\
- Run
bootstrap-vcpkg.bat
- Run
vcpkg.exe integrate install
- Run
vcpkg.exe install curl
- Create a new C++ project in Visual Studio and you’re ready to go – try it with the example above. There’s no need to modify project settings.