【问题标题】:how to set a flag (cpp-netlib)如何设置标志(cpp-netlib)
【发布时间】:2014-11-15 00:03:23
【问题描述】:

我认为我的问题真的很琐碎,但我仍然无法解决问题

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); ^

【问题讨论】:

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


    【解决方案1】:
    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

    【讨论】:

    猜你喜欢
    • 2013-02-09
    • 1970-01-01
    • 2015-06-03
    • 2013-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多