如何设置标志(cpp-netlib)

时间:2014-11-15 00:03:23

标签: c++ boost network-programming cpp-netlib

我认为我的问题非常简单,但我无法让它继续工作

std::string url="www.google.it";

boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);
boost::network::http::client::request req(url);
boost::network::http::client::response resp = client1_.get(req);
std::cout << "Body: " << body(resp) << std::endl;

return 0;

错误当然是指标志的声明......但是如何设置呢?

/home/snake91/cpp_pricing/underlying.cpp:67: error: C++ requires a type specifier for all declarations
    boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);

^

1 个答案:

答案 0 :(得分:3)

client::options options;
options.follow_redirects(true)
       .cache_resolved(true);

client client1_(options);

从文档的这一页开始:http://cpp-netlib.org/0.11.0/reference/http_client.html#general