With a default installion you will specify the curl
library to gcc
with -lcurl
, as reported by curl-config --libs
. And to pass this on the gcc
command line generated by VCLinux, add curl
to the Additional Library Dependencies line under Linker / Input in the VS project properties. Note that you enter just curl, VCLinux supplies the -l
and the gcc linker expands it to the actual filename of libcurl.a
(or libcurl.so
if you're linking a shared library).
You do not normally have to specify the library search path since /usr/lib
etc. are automatically on the library search path. On Debian 9 for example, libcurl.a
is in /usr/lib/i386-linux-gnu
. But if you install curl somewhere non-standard, add the path to Additional Library Directories under Linker / General. If you are installing curl from your Linux distribution, remember to install the development files as well; on Debian this is the package libcurl4-gnutls-dev
.
curl is compatible with pkg-config
so, as an alternative to entering the paths and library names directly, you can specify %24(pkg-config --cflags libcurl)
in C++ / All Options / Additional Options and %24(pkg-config --libs libcurl)
in Linker / All Options / Additional Options.
Note that %24
is an encoded $
because otherwise Visual Studio tries (and fails) to interpret the string as a macro.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…