C – Unefained reference to __gxx_personality_sj0`

When trying to execute this code with gcc 4.6:

#include 

using namespace std;

#include

int main()
{
//Int<> a;
long long min = std::numeric_limits::min();
unsigned long long max = std::numeric_limits::max();
cout << "min: "< cout << "max: "<< max <<' ';
cout << (min <= max);
std: :bitset<64> minimal(min);
cout << "minimal: "<< minimal;

return 0;
}

I accept To the following error:
1. Undefined __gxx_personality_sj reference
2. Undefined _Unwind_SjLj_Register reference
3. Undefined_Unwind_SjLj_Unregister reference
4. Undefined_Unwind_SjLj_Resume reference

What the hell is going on? !

These functions are part of GCC’s C exception handling support. GCC supports two exception handling, one One is based on the call to setjmp and longjmp (sjlj exception handling), and the other is based on the DWARF debugging information format (DW2 exception handling).

If you try to mix in a single executable file Using different exception handling to implement compiled objects, these types of linker errors will occur. You seem to be using DW2 GCC, but some of the libraries you are trying to use are compiled with the sjlj version of GCC, which causes these errors.

The short answer is that these problems are caused by ABI incompatibility between different compilers, so this happens when you mix libraries compiled by different compilers or use incompatible versions of the same compiler Situation.

When trying to execute this code with gcc 4.6:

#include 

using namespace std;

#include

int main()
{
//Int<> a ;
long long min = std::numeric_limits::min();
unsigned long long max = std::numeric_limits::max();
cout < <"min: "<< min <<' ';
cout << "max:" << max <<' ';
cout << (min <= max);
std::bitset<64> minimal(min);
cout << "minimal: "<< minimal; return 0;
}

I received the following error:
1. Undefined __gxx_personality_sj reference
2. Undefined _Unwind_SjLj_Register reference
3. Undefined_Unwind_SjLj_Unregister reference Use
4. Undefined _Unwind_SjLj_Resume reference

What is going on? !

These functions are part of GCC’s C exception handling support. GCC supports two exception handling, one is based on setjmp and longjmp (sjlj exception handling) The other is based on the DWARF debugging information format (DW2 exception handling).

If you try to mix and use different exception handling in a single executable file to implement a compiled object, it will happen These types of linker errors. You seem to be using DW2 GCC, but some of the libraries you are trying to use are compiled with the sjlj version of GCC, which causes these errors.

The short answer is that these problems are It is caused by ABI incompatibility between different compilers, so this happens when you mix libraries compiled by different compilers or use incompatible versions of the same compiler.

Leave a Comment

Your email address will not be published.