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.
Previous Post: php variable substitution/expansion
Comments are closed, but trackbacks and pingbacks are open.