4

我认为我的问题真的很微不足道,但我仍然无法让它工作

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:错误:C++ 需要所有声明的类型说明符
    boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);

^
4

1 回答 1

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

于 2014-11-15T00:07:47.417 回答