前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >LINUX下gdb无法debug,提示ImportError: No module named 'libstdcxx'

LINUX下gdb无法debug,提示ImportError: No module named 'libstdcxx'

作者头像
卡尔曼和玻尔兹曼谁曼
发布2019-01-22 11:08:04
2.3K0
发布2019-01-22 11:08:04
举报
文章被收录于专栏:给永远比拿愉快

Ubuntu下使用gdb调试C++程序,提示:ImportError: No module named ‘libstdcxx’。貌似CentOS没有这样的问题。

这是我的开发环境:

代码语言:javascript
复制
theone@ubuntu:~$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

theone@ubuntu:~$ gdb --version
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
theone@ubuntu:~$ python -V
Python 2.7.6

解决方案: 在自己的用户根目录下面新建.gdbinit文件 cd ~ vim .gdbinit 然后复制如下代码到.gdbinit文件:

代码语言:javascript
复制
python
import sys 
sys.path.append("/usr/share/gcc-4.8/python")
end

即在系统的path中添加gcc自带的python目录即可。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2015年10月22日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档