Undefined Symbol _Gxx_Personality_V0 on Link

Undefined Symbol ___gxx_personality_v0 on link

Use

g++ test.cpp

instead, since this is c++ code.


Or, if you really want to use gcc, add -lstdc++ to the command line, like so:

gcc test.cpp -lstdc++

Running md5 against the a.out produced under each scenario shows that it's the same output.

But, yeah, g++ probably makes your world a simpler place.

Link error undefined reference to `__gxx_personality_v0' and g++

If g++ still gives error Try using:

g++ file.c -lstdc++

Look at this post: What is __gxx_personality_v0 for?

Make sure -lstdc++ is at the end of the command. If you place it at the beginning (i.e. before file.c), you still can get this same error.

What is __gxx_personality_v0 for?

It is used in the stack unwiding tables, which you can see for instance in the assembly output of my answer to another question. As mentioned on that answer, its use is defined by the Itanium C++ ABI, where it is called the Personality Routine.

The reason it "works" by defining it as a global NULL void pointer is probably because nothing is throwing an exception. When something tries to throw an exception, then you will see it misbehave.

Of course, if nothing is using exceptions, you can disable them with -fno-exceptions (and if nothing is using RTTI, you can also add -fno-rtti). If you are using them, you have to (as other answers already noted) link with g++ instead of gcc, which will add -lstdc++ for you.

./libbar.so: undefined symbol: __gxx_personality_v0, how to solve it?

How can I remove the error?

Link your application with C++ library. Link with g++ or GLOBAL dlopen the libstdc++.so library. Overall, gcc -shared -o libbar.so bar.o should be g++ -shared -o libbar.so bar.o - it's a C++ library. gcc -Wl,--no-undefined -shared -o libbar.so bar.o catches the problem.

undefined reference to `__gxx_personality_v0' with gcc

Use either g++ - since your file is suffixed .cpp or rename the file to .c and keep the command line as is. Tested on Debian 6.0.5 with gcc 4.4.5.

Mysterious linker error undefined reference to `__gxx_personality_v0' using clang in cygwin

Found this solution:

https://cygwin.com/ml/cygwin/2015-06/msg00294.html

Basically just add -fno-exceptions on the command line when you compile for example clang++ helloworld.cpp -std=c++11 -fno-exceptions



Related Topics



Leave a reply



Submit