472,338 Members | 1,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,338 software developers and data experts.

undefined reference to '__gxx_personality_v0'

I have a small program, test.c. It runs OK. This is on Linux (kernel
2.6.8.1, GCC 3.4.1).

I decided to convert it to C++ before expanding it to a larger program. I
changed the filename to test.cpp and added

extern "C" {
}

around main and all the non-static subroutines. It compiles OK, but when I
link it, it says:

test.o (.eh_frame+0x11): undefined reference to '__gxx_personality_v0'

My program makes no reference to __gxx_personality_v0.

What do I need to do to get this program to link as a C++ program?

Thanks,
Allie
Dec 9 '05 #1
4 75106
Albert Oppenheimer wrote:
I have a small program, test.c. It runs OK. This is on Linux (kernel
2.6.8.1, GCC 3.4.1).

I decided to convert it to C++ before expanding it to a larger program. I
changed the filename to test.cpp and added

extern "C" {
}

around main and all the non-static subroutines. It compiles OK, but when I
link it, it says:

test.o (.eh_frame+0x11): undefined reference to '__gxx_personality_v0'

My program makes no reference to __gxx_personality_v0.

What do I need to do to get this program to link as a C++ program?


This is platform specific, but try compiling (and linking) with "g++"
rather than "gcc." Or, when you link, make sure you specify the C++
library (which gcc does automatically if you use g++ as your command
line rather than gcc).

If you have further questions, you'll get better help asking in a
platform-specific newsgroup.

Best regards,

Tom

Dec 9 '05 #2
Albert Oppenheimer wrote:
I have a small program, test.c. It runs OK. This is on Linux (kernel
2.6.8.1, GCC 3.4.1).

I decided to convert it to C++ before expanding it to a larger program. I
changed the filename to test.cpp and added

extern "C" {
}

around main and all the non-static subroutines. It compiles OK, but when I
link it, it says:

test.o (.eh_frame+0x11): undefined reference to '__gxx_personality_v0'

My program makes no reference to __gxx_personality_v0.

What do I need to do to get this program to link as a C++ program?

Thanks,
Allie


The __gxx part indicates that this is a g++-specific implementation
issue. The .eh_frame probably indicates that it is concerned with
exception handling, code for which may be automatically inserted for
C++ programs (but not for C). If so, you could disable exceptions with
a compiler flag or link in the proper symbols from a library that came
with your compiler (perhaps libstdc++?), which may not get pulled in
with your current compiler flags. As the other respondent said, any
follow-up should be directed to a GNU newsgroup see the FAQ for some
alternate newsgroups:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Cheers! --M

Dec 9 '05 #3
Hello Albert,

Albert Oppenheimer wrote:
I have a small program, test.c. It runs OK. This is on Linux (kernel
2.6.8.1, GCC 3.4.1).

I decided to convert it to C++ before expanding it to a larger program. I
changed the filename to test.cpp and added
This already enough to make it a C++ program. GCC will automatically compile
it as a c++ program because of the cpp extension.
extern "C" {
}

around main and all the non-static subroutines. It compiles OK, but when
I link it, it says:
It's not necessary. Remove the extern "C" stuff and try again, it should
compile and link fine.
You need the extern "C" only if you are calling a C function, like printf()
from a C++ module. If you would like to know more, google for "name
mangling" and you should find good explanations for it and what it's for.
test.o (.eh_frame+0x11): undefined reference to '__gxx_personality_v0'

My program makes no reference to __gxx_personality_v0.

What do I need to do to get this program to link as a C++ program?

Thanks,
Allie


hth Peter

Dec 9 '05 #4
Thanks, it linked and ran fine after I used g++.
Dec 9 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This...
1
by: Stu | last post by:
I am trying to build the xerces shared library with 2.3.0 version of their source code on an AIX 5.1 32 bit machine with the following version of...
1
by: Codemutant | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** I just cannot find what is undefined in this code.
1
by: Foolster41 | last post by:
I'm rather new to C++ programing. I'm using the dev-C++ program on a windows XP OS. I'm trying to compile the code for a multi user dungeon (MUD)...
1
by: Dom | last post by:
I'm new to c++. Just started learning it 24 hours ago. Am running into a compile problem. Please, no one waste the effort telling me to google it....
3
by: Michael Sgier | last post by:
Hi i get thousands of messages like below. How shall i resolve that? Thanks Mcihael Release/src/Utility/RawImage.o: In function...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b>...
3
by: prakash.mirji | last post by:
Hello, I am getting below mention linker error when I tried to link my class test.C I use below command to compile test.C /usr/bin/g++ -g...
1
by: taiyang902 | last post by:
i program under linux ,and using kdevelop c/c++. the code follow, #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <iostream>...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.