Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asio/connection.hpp 文件的第 318 行遇到了一个类型不匹配的问题,编译出错 #1129

Open
henry3695 opened this issue Mar 12, 2024 · 1 comment

Comments

@henry3695
Copy link

    timer_ptr set_timer(long duration, timer_handler callback) {
        timer_ptr new_timer(
            new lib::asio::steady_timer(
                *m_io_service,
                lib::asio::milliseconds(duration))
        );

这个错误信息表示在编译过程中,websocketpp 库中的 asio/connection.hpp 文件的第 318 行遇到了一个类型不匹配的问题。具体来说,boost::asio::basic_waitable_timer 的构造函数期望得到一个 boost::chrono::time_point 类型的引用作为参数,但是这里却试图传入一个 std::chrono::milliseconds 类型的值。

在 Boost.Asio 中,basic_waitable_timer 的构造函数通常接受一个表示时间点(time point)的 boost::chrono::time_point 对象,或者一个表示时间间隔(time duration)的 boost::chrono::duration 对象。错误表明你尝试使用了一个 std::chrono::milliseconds 对象,它代表一个时间间隔,而不是时间点。

我boost版本是1.52.0,请问下这个问题该怎么解决

@tiemuhua
Copy link

我的建议是换个websocket开源实现。这玩意模版类套模版类,完全看不懂,出了问题查都没法查。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants