undefined reference to `__gxx_personality_sj0′

I am compiling a dll with 3 .c files and one .cpp file using mingw gcc, when this error occurs “undefined reference to `__gxx_personality_sj0′”.  The reference comes from the .cpp file. Searching the error on google gets me the article:http://stackoverflow.com/questions/7751640/undefined-reference-to-gxx-personality-sj0, which says it is caused by “mixing objects which were compiled with different exception handling implementations in a single executable.” It seems that when compiling .c files using the gcc command, it uses the DW2 exception handling while compiling the .cpp file, it uses the sjlj exception handling. At linking stage, it links with the DW2 exception handling library so the sjlj exception handling references cannot be found, thus producing the error. The solution is to change the suffix of the .cpp file from cpp to c so the compiler produces the DW2 exception handling references for it.

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:
Posted in

Comments are closed, but trackbacks and pingbacks are open.