【发布时间】:2014-08-09 11:48:30
【问题描述】:
所以,我正在学习一个教程,尝试设置一个基本计时器...
void print(const boost::system::error_code &e)
{
std::cout <<"hello world"<< std::endl;
}
int main()
{
boost::asio::io_service io;
boost::asio::deadline_timer timer(io, boost::posix_time::seconds(5));
timer.async_wait(print);
io.run();
}
构建良好,但在运行时;
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): thread: The attempted operation is not supported for the type of object referenced
Win7, GCC, 代码::blocks
编辑;在另一台具有相同设置的机器上进行了尝试 - 结果相同。
再次编辑;我应该从 boost 1_47 切换到最新版本吗?
【问题讨论】:
-
你链接到 pthreads 了吗?为 GCC 提供
-pthreads -
没有骰子。是否有我必须#include 的标题?目前我只有 asio.hpp 和 iostream。
-
标题照原样很好。
-
你现在推荐什么?
-
我建议你等待认识你情况的人过来:|如果我知道答案,我想我会马上告诉你。耐心,学徒(哦,并且阅读)
标签: c++ boost boost-asio