我正在尝试编译此代码(取自cpp-netlib文档):
#include <boost/network/protocol/http/client.hpp>
#include <iostream>
int main(int argc, char *argv[]) {
using namespace boost::network;
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " [url]" << std::endl;
return 1;
}
http::client client;
http::client::request request(argv[1]);
request << header("Connection", "close");
http::client::response response = client.get(request);
std::cout << body(response) << std::endl;
return 0;
}
但是,它失败并出现此错误:
Error C2446 ':': no conversion from 'boost::asio::error::netdb_errors' to 'const std::error_code'
我正在使用 VS2015、cpp-netlib 0.12.0(最终版)和 Boost 1.55.0,但我不知道是什么原因造成的。有没有办法解决它?几天来,我一直在挠头试图让这个库工作,但不幸的是,似乎总是要出现一个新错误。