G ++总是失败,并且对_Unwind_GetIPInfo有未定义的引用 [英] G++ always fails with undefined reference to _Unwind_GetIPInfo

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

问题描述

我刚刚升级到我的华硕EeePC上网本上的Ubuntu 11.04,并且G ++有问题。使用G ++编译任何程序,即使是简单的Hello World,无论使用iostream,cstdio还是stdio.h,都会失败,并显示消息: c $ c> /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/libstdc ++。so:对_unwind_GetIPInfo@GCC_4.2.0的未定义引用
collect2:ld返回1退出状态

我使用Synaptic Package Manager。在升级之前,Ubuntu提供了GCC 4.4,但我也通过另一个仓库安装了GCC 4.5(gcc-4.5)。 GCC 4.5现在是Ubuntu 11.04的默认设置。



我认为这个问题可能与libgcc有关。我尝试重新安装GCC,但无法删除libgcc:首先,新立得软件包管理器报告说某处存在破损的软件包,并停止尝试;但我也注意到,删除libgcc需要删除几乎每个应用程序,包括apt和Firefox。



我也尝试了gcc-snapshot包;不幸的是,它给出了上面列出的同样的错误。



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

$ b $ c

解决方案

在我的情况下,它也是 $ LIBRARY_PATH 中的第一个条目。该条目是 $ G95 / g95-install / lib / gcc-lib / i686-unknown-linux-gnu / 4.0.3 / 并且与G95 Fortran编译器有关。我前一段时间在.bash_profile中自己做了这件事,就像我那时经常将C ++程序链接到同一目录中的libfortran.a库。删除此条目解决了我的问题。将来我会使用-L切换到GCC来处理这种情况。


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

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.

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.

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

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

解决方案

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天全站免登陆