This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

minor gcc2->gcc3 migration nit


Just posting this so anyone looking for this error message can find it in google.

Sometimes people want to link c++ programs by invoking gcc instead of g++.

With gcc-2.95.x, this works if you add -lstdc++, e.g.
  gcc hello.cc -lstdc++

Doing that with gcc-3.3.3 gives errors like

libstdc++.so: undefined reference to `_Unwind_DeleteException@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_Resume@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_RaiseException@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_GetRegionStart@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_GetDataRelBase@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_SetGR@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_GetLanguageSpecificData@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_Resume_or_Rethrow@GCC_3.3'
libstdc++.so: undefined reference to `_Unwind_GetIP@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_GetTextRelBase@GCC_3.0'
libstdc++.so: undefined reference to `_Unwind_SetIP@GCC_3.0'

This is because a shared library libgcc_s.so was added
(it's a very long story; here are a few random messages about it:
http://gcc.gnu.org/ml/gcc/1998-05/msg01001.html
http://gcc.gnu.org/ml/gcc/2000-05/msg00014.html
http://gcc.gnu.org/ml/gcc/2002-06/msg00583.html
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02210.html)

The fix is simply to add -lgcc_s, e.g.
  gcc hello.cc -lstdc++ -lgcc_s

- Dan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]