G++ 总是因未定义的 _Unwind_GetIPInfo 引用而失败 [英] G++ always fails with undefined reference to _Unwind_GetIPInfo

查看:28
本文介绍了G++ 总是因未定义的 _Unwind_GetIPInfo 引用而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在我的 Asus EeePC 上网本上升级到 Ubuntu 11.04,并且在使用 G++ 时遇到了问题.使用 G++ 编译任何程序,即使是简单的Hello World",无论是使用 iostream、cstdio 还是 stdio.h,都会失败并显示以下消息:

I've just upgraded to Ubuntu 11.04 on my Asus EeePC netbook, and have a problem with G++. Compiling any program using G++, even a simple "Hello World", whether using iostream, cstdio, or stdio.h, fails with the message:

/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/libstdc++.so: undefined reference to `_Unwind_GetIPInfo@GCC_4.2.0'
collect2: ld returned 1 exit status

我使用 Synaptic 包管理器.在升级之前,Ubuntu 提供了 GCC 4.4,尽管我还通过另一个存储库安装了 GCC 4.5 (gcc-4.5).GCC 4.5 现在是 Ubuntu 11.04 的默认设置.

I use Synaptic Package Manager. Before the upgrade, Ubuntu provided GCC 4.4, though I had also installed GCC 4.5 (gcc-4.5) via another repository. GCC 4.5 is now the default in Ubuntu 11.04.

我认为问题可能与 libgcc 有关.我尝试重新安装GCC,但我无法删除libgcc:首先,Synaptic Package Manager,报告某处有损坏的包,并停止了我的尝试;但我也注意到,删除 libgcc 需要删除几乎所有应用程序,包括 apt 和 Firefox.

I think the problem may be to do with libgcc. I tried reinstalling GCC, but I couldn't remove libgcc: first of all, Synaptic Package Manager, reported that there are broken packages somewhere, and stopped my attempt; but I also noted that to remove libgcc would require the removal of almost every application, including apt and Firefox.

我也试过 gcc-snapshot 包;不幸的是,它给出了上面列出的相同错误.

I also tried the gcc-snapshot package; unfortunately, it gives the same error listed above.

有什么方法可以使用 Synaptic Package Manager 获取 G++ 的最新可用版本?

Is there any way to use Synaptic Package Manager to obtain a recent, working version of G++?

推荐答案

GCC-4.6 在 $LIBRARY_PATH 中发现了一个较旧的、不兼容的 libgcc.a 版本;就我而言,它也是 $LIBRARY_PATH 中的第一个条目.该条目是 $G95/g95-install/lib/gcc-lib/i686-unknown-linux-gnu/4.0.3/ 并且与 G95 Fortran 编译器有关.前段时间我自己在 .bash_profile 中完成了这项工作,因为我当时经常将 C++ 程序链接到同一目录中的 libfortran.a 库.删除此条目解决了我的问题.将来我会在这种情况下使用 -L 切换到 GCC.

GCC-4.6 was finding an older, incompatible version of libgcc.a in $LIBRARY_PATH; in my case it was the also the first entry in $LIBRARY_PATH. The entry was $G95/g95-install/lib/gcc-lib/i686-unknown-linux-gnu/4.0.3/ and relates to the G95 Fortran compiler. I had done this myself some time ago, in the .bash_profile, as I would, at that time, often link C++ programs to the libfortran.a library in that same directory. Removing this entry fixed my problem. In future I would use the -L switch to GCC for such situations.

这篇关于G++ 总是因未定义的 _Unwind_GetIPInfo 引用而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆