Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link error "undefined reference to `__gxx_personality_v0'" and g++ [duplicate]

Tags:

c++

g++

Possible Duplicate:
Undefined Symbol ___gxx_personality_v0 on link

I have a problem with the following program.

// fkt.cpp  #include "fkt.h"  int add2(int a, int b) {     return a+b; } 

And the header:

// fkt.h  int add2(int a, int b); 

Now I compile this with:

g++ -c fkt.cpp 

Now I run nm and get:

00000000 T _Z6add2ii          U __gxx_personality_v0 

When I want to use the function anywhere I get:

(.eh_frame+0x12): undefined reference to `__gxx_personality_v0' 

How can I solve this problem? (I'm using Ubuntu Linux.)

like image 243
develhevel Avatar asked May 18 '11 13:05

develhevel


1 Answers

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.

like image 106
phoxis Avatar answered Oct 09 '22 11:10

phoxis