linux 下使用 boost::bind ,程序崩溃了

gucheng789 2016-10-17 05:21:15
打算在linux 下学习boost,最近在学boost bind。
看了一些资料不懂,如下程序为啥运行会崩溃。

代码:

#include <stdio.h>
#include <boost/asio.hpp>
#include <boost/bind.hpp>

static void handler()
{
printf(" handler \n");
}

int main()
{
boost::bind(&handler)();
...


运行的时候出现错误:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): bind: Permission denied
Aborted (core dumped)

linux 是centos6.5的,
...全文
488 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ztenv 2016-10-18
  • 打赏
  • 举报
回复
1、c++不要使用stdio.h,而使用stdio 2、怀疑是你的权限不足导致的 3、你用的g++什么版本?
赵4老师 2016-10-18
  • 打赏
  • 举报
回复
进程意外退出会在当前目录下产生‘core’文件或形如‘core.数字’的文件比如‘core.1234’ 使用命令 gdb 运行程序名 core或core.数字 进入gdb然后使用bt命令 可以查看进程意外退出前函数调用的堆栈,内容为从上到下列出对应从里层到外层的函数调用历史。 如果进程意外退出不产生core文件,参考“ulimit -c core文件最大块大小”命令
gucheng789 2016-10-17
  • 打赏
  • 举报
回复
怎么会运行时出现权限不足呢?
gucheng789 2016-10-17
  • 打赏
  • 举报
回复
没有绑定什么,绑定的函数没有参数也没有返回值,
AlbertS 2016-10-17
  • 打赏
  • 举报
回复
你绑定的是什么?没有看到定义,显示没有权限

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧