gpt4 book ai didi

c++ - 如何设置标志(cpp-netlib)

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:02:06 25 4
gpt4 key购买 nike

我认为我的问题真的很微不足道,但我还是无法让它发挥作用

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

^

最佳答案

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

关于c++ - 如何设置标志(cpp-netlib),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26940861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com