Python 导入错误:没有模块名libstdcxx < >我用GDB调试我的C++程序,用分段故障< /强>,我在GDB中出现这个错误。
回溯(最近一次呼叫最后一次): 文件“/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py”,第63行,在 从libstdcxx.v6.printers导入寄存器\u libstdcxx\u打印机 ImportError:没有名为“libstdcxx”的模块Python 导入错误:没有模块名libstdcxx < >我用GDB调试我的C++程序,用分段故障< /强>,我在GDB中出现这个错误。,python,c++,c,linux,Python,C++,C,Linux,回溯(最近一次呼叫最后一次): 文件“/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py”,第63行,在 从libstdcxx.v6.printers导入寄存器\u libstdcxx\u打印机 ImportError:没有名为“libstdcxx”的模块 我使用的是GDB7.7.1和g++版本4.8.4。我在谷歌上搜索过,但没有找到答案。谁能解决我的错误?非常感谢。这是/usr/lib/deb
我使用的是GDB7.7.1和g++版本4.8.4。我在谷歌上搜索过,但没有找到答案。谁能解决我的错误?非常感谢。这是/usr/lib/debug/usr/lib/$triple/libstdc++.so.6.0.18-gdb.py中的一个bug; 启动gdb时,请输入:
python sys.path.append(“/usr/share/gcc-4.8/python”);
我在emacs中使用gdb时遇到了这个错误。(在docker容器中-ubuntu)
我试了一下,效果很好
(1) 打开libstdc++.so.x.x.x-gdb.py
sh> sudo vi /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py
(2) 修改该文件(libstdc++.so.x.x.x-gdb.py
)如下图所示
import sys
import gdb
import os
import os.path
pythondir = '/usr/share/gcc-4.8/python'
libdir = '/usr/lib/x86_64-linux-gnu'
sys.path.append(pythondir) <-- add this code
导入系统
导入gdb
导入操作系统
导入操作系统路径
pythondir='/usr/share/gcc-4.8/python'
libdir='/usr/lib/x86_64-linux-gnu'
sys.path.append(pythondir)如果使用
sudo
启动gdb,请确保路径正确
试试这个
sudo PATH=$PATH gdb…
我从gcc安装路径中选择了libstdcxx,这个错误就消失了
sys.path.insert(0, '/global/freeware/Linux/RHEL6/gcc-6.2.0/share/gcc-6.2.0/python')
首先谷歌搜索。。。。在我的环境中本地安装的gcc路径也为我工作!
sys.path.insert(0, '/global/freeware/Linux/RHEL6/gcc-6.2.0/share/gcc-6.2.0/python')