So I've been trying to statically link the libcurl library to my project for the past DAY and I'm literally pulling my hair out. Everywhere on the internet different instructions are given and none seem to work. I've never statically liked a library before but now I have to (for the sake of keeping things organized).
So my project is a .dll file, which requires the libcurl library to function. I've managed to build a libcurl.lib file from the libcurl source, but I have no idea what I need to do with the properties of my dll project. I've tried adding it to "Additional library directories", "Additional include directories", "Additional dependencies" all without success. Some configurations seem to work, but in the end it still doesn't link statically, only dynamically. Oh, and I'm using Visual Studio 2013.
Does anyone have any experience statically linking libcurl? Any help would be much appreciated. Thanks!
Project > Properties > C/C++ > General > Additional Include Directories
. List a directory there that's the parent of a directory namedcurl
, which in turn contains a file namedcurl.h
. – Igor Tandetniklibcurl.dll
can't be found, or that it's required at all? I thought it was the latter, but your last comment makes it sound like the former. If it's "not found" what bothers you, copylibcurl.dll
to the same directory where your EXE is (usually, ProjectName\Debug or ProjectName\Release). – Igor Tandetnik.lib
extension. A static library contains actual code; when linked, that code physically becomes part of the executable (EXE or DLL) it's linked with. An import library doesn't contain any code, just references to functions exported from a companion DLL; when linked, the executable takes a dependency on said DLL. As far as I can tell,libcurl.lib
you have is of this latter variety - an import lib. – Igor Tandetniklibcurl.dll
, it came together withlibcurl.lib
import library, and perhaps that's the one the linker is picking up. How to tell them apart: a static library is typically large, about the same size as the DLL or even larger, while import library is a fraction of the size. If you do in fact have two of them, try renaming the smaller one, to make sure you aren't inadvertently linking with it. – Igor Tandetnik