English 中文(简体)
“_gxx_ Personity_sj0'
原标题:undefined reference to `__gxx_personality_sj0`

在试图执行该法典时使用4.6英寸:

   #include <iostream>

using namespace std;

#include <bitset>

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

   return 0;
}

I m getting the following error:
1. undefined reference to __gxx_personality_sj
2. undefined reference to _Unwind_SjLj_Register
3. undefined reference to _Unwind_SjLj_Unregister
4. undefined reference to _Unwind_SjLj_Resume

What on hell is going on?!

问题回答

这些职能是C++例外处理支助海合会的一部分。 海湾合作委员会支持两种例外处理方式,一种是呼吁设置障碍和长效(jlj例外处理),另一种是基于DWARF分解信息格式(DW2例外处理)。

会出现这种联系人错误的,是你试图将所汇编的物体与不同的例外地处理单一可执行的物品混为一谈。 看来,你正在使用海合会,但你试图使用的一些图书馆被汇编成海合会的jlj版本,造成这些错误。

简短的答案是,这类问题是由不同汇编者之间不一致造成的,因此,如果你将图书馆与不同的汇编者混为一谈,或使用同一汇编者的不兼容版本,就会出现这种情况。

缩略语 在一份评论中,您可以使用<代码>gcc,重点是C 方案,但您有。 C++ Program。

汇编<代码>C++ 方案,确保使用<代码>g++汇编器司机!

例如:

BAD:gcc -o foo.exe foo.cpp

GOOD:g++-o foo.exe foo.cpp

就在任何其他情况下都存在这一问题: 我改变了制作<代码>的词汇表>。

当我重新设计同一项目时,新的汇编者没有建立新的<代码>。 在删除旧档案和重建之后,错误是固定的。

我假定从零开始重建,不删除。

The gcc command is just a driver program that runs the right compiler for the source file you give it, (or run the linker if you give it object files). For a C++ source file with a known file extension it will run the C++ compiler (which for GCC is called cc1plus) and compile the code correctly.

<>But与C++自动链接 标准图书馆(名称为libstdc++/code>)。

为了解决这个问题,你要么需要将<代码>-lstdc++>明确与这一图书馆连接,要么在连接时,或者仅仅汇编和链接到g++的驱动器,而后者则自动将-lstdc++<>>>添入链接器选项。

因此,你可以使用<代码>gcc汇编C++方案,但如果你使用标准图书馆或C++操作时间(包括例外处理)的任何特征,则需要与C++操作时间连接<代码>。 -lstdc++ (or -lsupc++ for only theprtime). 采用<条码>g++/代码>对您来说是自动的。

手册中对此做了记录:

Use minGW-g++.exe not gcc.exe See what happens now.





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签