我升级到 Windows 10 并试图让 curlpp 与 MS Visual Studio 2013 一起工作。我从 github 下载了第一个简单示例:
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
using namespace curlpp::options;
int main(int, char **)
{
try
{
// That's all that is needed to do cleanup of used resources (RAII style).
curlpp::Cleanup myCleanup;
// Our request to be sent.
curlpp::Easy myRequest;
// Set the URL.
myRequest.setOpt<Url>("http://example.com");
// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}
catch(curlpp::RuntimeError & e)
{
std::cout << e.what() << std::endl;
}
catch(curlpp::LogicError & e)
{
std::cout << e.what() << std::endl;
}
return 0;
}
解决这个问题的最佳方法是什么?我在附加的包含目录中添加了 curl 和 curlpp 目录,但是当我构建程序时,我得到 26 个错误和 18 个警告。这个答案How to use cURLpp/libcurl with Visual C++ 2008 Express表明为 MS Visual Studio 做这件事可能会很痛苦,所以我可以毫无问题地为这个项目切换到另一个编译器或 IDE。
为了帮助澄清,我得到的大多数错误都是以下形式: curlpp::x::z definition of dllimport function not allowed。