我刚刚更新了 boost 库1.68.0
to 1.70.0
获取超时操作(beast) websocket ssl 客户端异步 example https://www.boost.org/doc/libs/1_70_0/libs/beast/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp.
在上面的链接中您将看到:
void
on_resolve(
beast::error_code ec,
tcp::resolver::results_type results)
{
if(ec)
return fail(ec, "resolve");
// Set a timeout on the operation
beast::get_lowest_layer(ws_).expires_after(std::chrono::seconds(30));
// Make the connection on the IP address we get from a lookup
beast::get_lowest_layer(ws_).async_connect(
results,
beast::bind_front_handler(
&session::on_connect,
shared_from_this()));
}
有不止一个函数使用此结构来实现超时。对于我的代码(在 eclipse-cdt 中我看到它是这样的
错误提示(当鼠标指针悬停在过期时间 or 异步连接):
无法解析方法“expires_after”
OR
无法解析方法“async_connect”
当鼠标指针移到“get_lowest_layer”上时,错误提示
无效参数'
候选人是:
boost::beast::detail::lowest_layer_type_implboost::beast::detail::has_next_layer_impl
boost::beast::detail::has_next_layer_impl 1 #0 0 71 4417 0 0>::type & get_lowest_layer(#0 &)
'
我想知道我需要为此链接一些库。我不知道是哪一个。有什么建议么?
这与so库无关。
boost::beast 是一个模板库,因此没有共享库。
您的编辑器使用定义(而不是链接)来显示此 IDE 错误。基本上,您的编辑器未能找到您指向的标题。
如果我不得不猜测,您已经手动编译了 boost 来使用 boost::beast,因为它在大多数现代 Linux 发行版上不可用。或者您可能没有使用 Linux。该示例有一些包含,并且您的 IDE 无法解析它们,因为它们不在您的系统包含中(/usr/include
)。所以,它不知道该去哪里寻找。
因此,总而言之,您的构建系统未与 IDE 正确耦合。
要解决该问题,请尝试了解您的 IDE 如何解决丢失的标头。添加包含 boost 标头的包含路径。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)