LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2014, 07:21 PM   #1
iceman81
Member
 
Registered: Jan 2013
Location: New Jersey
Distribution: CentOS, Arch
Posts: 149

Rep: Reputation: Disabled
gcc error


i'm trying to compile a c++ hello world program and i'm getting an error.

installed "Development Tools"


[iceman@localhost progs]$ gcc helloworld.cpp -o helloworld
/tmp/ccaTNXGp.o.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[iceman@localhost progs]$

[iceman@localhost progs]$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

any ideas how i can fix this?
 
Old 11-28-2014, 07:32 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
I hate to be "that guy", but did you try a search?

A simple google search for that exact error message returns over 12,000 matches, the top ten of which (at least) all have the solution.

The gist of it is you named your file helloworld.cpp, a C++ extension, but are using gcc, a C compiler, to build it. The solution is to either use g++, the C++ compiler, or rename your file to helloworld.c.

Last edited by suicidaleggroll; 11-28-2014 at 07:33 PM.
 
1 members found this post helpful.
Old 11-28-2014, 07:43 PM   #3
iceman81
Member
 
Registered: Jan 2013
Location: New Jersey
Distribution: CentOS, Arch
Posts: 149

Original Poster
Rep: Reputation: Disabled
yes i did do a search of "gcc compile error undefined reference" , when i tried to copy/paste the exact error i got no hits, but the former gave me 393,000 hits and none of which did i find that explanation, a lot of them were referencing what headers you were using and the links to those files. totally forgot the command was g++, i try not to be "that guy" aw well.

either way thanks for the response and you solved my issue.
 
Old 11-28-2014, 07:54 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by iceman81 View Post
when i tried to copy/paste the exact error i got no hits
That is odd. I literally copied and pasted the error message from your post straight into google:

undefined reference to `__gxx_personality_v0'

Maybe it was an issue with the tick marks, compiler errors use that weird back tick for the start of the message ( ` instead of ' ), without that it might not match correctly. But yeah, a search for "undefined reference" will provide hundreds of thousands of useless matches where people didn't use the proper includes.

Either way, glad it solved your issue.
 
Old 11-28-2014, 08:33 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,825

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
Quote:
undefined reference to `__gxx_personality_v0'
i just highlighted that line and from the seamonkey "r-click" menu selected "search google for....."
the very first hit in google is a stackoverflow post
http://stackoverflow.com/questions/6...personality-v0
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
collect2: error: ld returned 1 exit status , for make install gcc-4.8.1 in gcc-pass1 cola Linux From Scratch 1 02-16-2014 11:51 PM
[SOLVED] Gcc error building tools on 7.4.rc1 chapter 5.10. GCC-4.8.1 - Pass 2 Keith Hedger Linux From Scratch 3 08-29-2013 12:30 PM
Compile error, 'H5G_obj_t' does not name a type, is gcc 4.3 incompatible with gcc 3 ? samrat_rao Linux - Software 5 03-03-2009 03:28 PM


All times are GMT -5. The time now is 04:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration