I am having trouble getting LibCurl to work with Visual Studio 2013. I downloaded the current version (curl-7.33.0) and tried following the instructions I found on this site: Using LibCurl with Visual 2010
But I can't find curllib.lib in the folder I downloaded. And I am still getting errors:
After searching the internet for more help. I now get these error messages. There appears to be a problem with linking to libcurl.lib?
This is what I have configured:
Inside /lib I have libcurl.lib and libcurl.dll
UPDATE
I downloaded this release for Win32 MSVC: http://curl.haxx.se/download.html#Win32 After adding the libcurl libraries and successfully compiling, I am now getting this error message:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
Here is the sample code I am trying to run:
#include <iostream>
#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://google.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
FINAL UPDATE
I believe I have gotten LibCurl to work with Visual Studio 2013 now. Persistence ftw! Although, after spending hours trying to solve these error messages, I am a little hesitant at saying everything is working fine now. That is why I am putting a bounty on this question to get clear and concise instructions on getting LibCurl to work with Visual Studio 2013.
This is what I did to get it to work:
First, download the Win32 MSVC package here: http://curl.haxx.se/download.html#Win32 For these instructions sake, let's say you downloaded to C:\LibCurl
Start a new project in Visual Studio. Go to Project|Project Properties|VC++ Directories|Include Directories| Add the path to the include directory inside the downloaded package. (C:\LibCurl\include)
Next, go to Project|Project Properties|Linker|General|Additional Library Directories| Add the path to the lib directory. (Where curllib.dll is located)
Then, go to Project|Project Properties|Linker|Input|Additional Dependencies| And add curllib.lib
Now if you compile a test program, you will likely get the message saying libsasl.dll is missing. You will need to download this file and put it in the same directory as your build. I used 7-Zip to extract libsasl.dll from OpenLDAP for Windows. OpenLDAP for Windows
This is the result of my test code from above:
I would say that in a comment, but I am lacking in points. You don't have to copy any .dll into your program run catalog. Go to Project | Properties | Configuration Properties and in line Envrionment write:
PATH=$(ExecutablePath)$(LocalDebuggerEnvironment)
.From now on, all .dlls from any catalog you mention in Project|Project Properties|VC++ Directories|Binary should be usable without copying them.
The rest is exactly as you written.
A lot of these instructions are out of date because they recommend the win32-ssl-devel-msvc package for curl, which no longer exists.
The following instructions allow you to build libcurl using only:
A. Build libcurl static library
C:\libcurl
)"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
To initialize your VC environment variables (adjust your VS 2013 installation directory as needed)cd C:\libcurl\winbuild
nmake /f Makefile.vc mode=static VC=12
C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl
B. Link Against libcurl in Visual Studio
C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\include
CURL_STATICLIB
C:\libcurl\builds\libcurl-vc12-x86-release-static-ipv6-sspi-winssl\lib
libcurl_a.lib
C. Call libcurl from Your Project
The following sample shows a call to libcurl:
Download the curl v7.37.0 source code and use the Visual Studio project files provided.
I've spent the last few weeks polishing my own personal project files, that were based off the original VC6 files, and adding them to the repository.
.dsw / .dsp (VC6), .sln / .vcproj (VC7, VC7.1, VC8 and VC9 as well as .sln / .vcxproj (VC10, VC11 and VC12) files are provided for both DLL and Static Library builds with support for OpenSSL and Windows SSPI / SChannel in both Win32 and x64 configurations.
I tried to do it from scratch with VS2012 (I don't have 2013) and it works perfectly.
So, I'm not sure what your problem is, but:
The problem is that the targets for the default VS2013 platform tools are not set in the NuGet packages. This is why it works in VS2012 but not VS2013. I manually created replacement targets files. Instructions and download:
https://github.com/evoskuil/curl-nuget-targets
This is a bit late, but for those who still have problems, this method worked best for me:
For example:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
.http://curl.haxx.se/download.html
and unzip.curl-X/winbuild
.vcvars32.bat
.nmake /f Makefile.vc mode=static VC=12
.curl-X/builds/libcurl-XXX
.There you find the includes and a
libcurl_a.lib
. This lib works fine for me.Remember to define
-DCURL_STATICLIB
when you compile your code with this lib.