答案 0 :(得分:1)
除非您已指示编译器在独立安装curl库的位置搜索标题,否则您可能正在寻找双引号,假设您已包含curl源。否则,您将需要在项目设置中摆弄包含路径。
What is the difference between #include <filename> and #include "filename"?
区别在于预处理器搜索包含文件的位置。
对于#include&#34; filename&#34;预处理器在与包含该指令的文件相同的目录中进行搜索,然后对#include进行搜索。此方法通常用于包含程序员定义的头文件。
对于#include&lt;文件名&gt;预处理器以依赖于实现的方式搜索,通常在编译器/ IDE预先指定的搜索目录中。此方法通常用于包含标准库头文件。
答案 1 :(得分:0)
In short,
Add the path of the libcurl's include folder in C/C++ -? General -> Additional include directories. This way the Visual Studio will get to know the location of curl.h
In Detail:
Using libcurl involves 2 steps:
1. Download and build libcurl on your platform.
2. Plug-it in your C\C++ application
Step 1:
Download code from https://curl.haxx.se/download.html and unzip the zip file in a folder. I guess you already have done it.
cd curl-src\winbuild
nmake /f Makefile.vc mode=<static or dll> <options>
VC=<6,7,8,9,10,11,12,14> - VC versions
WITH_DEVEL=<path> - Paths for the development files (SSL, zlib, etc.)
Defaults to sibbling directory deps: ../deps
Libraries can be fetched at http://windows.php.net/downloads/php-sdk/deps/
Uncompress them into the deps folder.
WITH_SSL=<dll or static> - Enable OpenSSL support, DLL or static
WITH_MBEDTLS=<dll or static> - Enable mbedTLS support, DLL or static
WITH_CARES=<dll or static> - Enable c-ares support, DLL or static
WITH_ZLIB=<dll or static> - Enable zlib support, DLL or static
WITH_SSH2=<dll or static> - Enable libSSH2 support, DLL or static
ENABLE_SSPI=<yes or no> - Enable SSPI support, defaults to yes
ENABLE_IPV6=<yes or no> - Enable IPv6, defaults to yes
ENABLE_IDN=<yes or no> - Enable use of Windows IDN APIs, defaults to yes
Requires Windows Vista or later, or installation from:
https://www.microsoft.com/downloads/details.aspx?FamilyID=AD6158D7-DDBA-416A-9109-07607425A815
ENABLE_WINSSL=<yes or no> - Enable native Windows SSL support, defaults to yes
GEN_PDB=<yes or no> - Generate Program Database (debug symbols for release build)
DEBUG=<yes or no> - Debug builds
MACHINE=<x86 or x64> - Target architecture (default is x86)
For More info, you can read INSTALL file present in the downloaded zip.
Step 2: Once you have the library built, plug-it in you application as:
a) Right Click the VS project in which you want to add the dependency of curl and select properties.
b) Add the path of the libcurl's include folder in C/C++ -> General -> Additional include directories. This way the Visual Studio will get to know the location of curl.h
c) Add the path of libcurl library in linker -> General -> Additional Library Directories.
d) Mention libcurl name in Linker -> input -> Additional Dependencies.
You are good to go !
Note: if you are using dll for curl, then this dll should be present in the same directory in which your .exe for the application is present.