开发者

G++ always fails with undefined reference to _Unwind_GetIPInfo

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++?


The operative word: --reinstall

sudo apt-get install libstdc++ --reinstall

Add all package you suspect are corrupted


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜