Thread: Error message when compiling source code

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    9

    Error message when compiling source code

    Hi Guys, newbie at C programming. Suddenly getting error message when compiling source codes......
    Undefined symbols:
    "__gxx_personality_v0", reference from:
    _main in cddldVR.o
    CIE in ccddLdVR.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    Need help to correct this...have not tried anything.....scared things would get worst.

    Using MAC os X

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Those are linker errors... are your library paths set correctly?

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    The function in question is a native part of GCC; GCC, properly built, knows where to look for those bits relative to the GCC executable.

    If you are using an old version, don't compile C++ with GCC.

    Otherwise, you have a borked installation. Where did you get it? What did you install it? *other questions?* Seriously, just tell us a lot about what your installation.

    Soma

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    Everything was working before, problem started today. The path to my learn directory is correct since I am creating all the source code in the same directory where I am compiling them. I do recognized that it is a linker problem. I am wondering if I reinstall the mac app Xcode.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    If it was working until today... what changed?
    Did you change any settings? Did you delete any folders or move stuff around?
    Backtrack and see if you can figure it out before you go deleting and reinstalling.

    (Troubleshooting is a big part of programming... so this turns out to be a good learning opportunity for you.)

  6. #6
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    First of all thanks guys for the comments. The only thing that changed was during compiling a file I mistakenly typed zero (0) instead of the letter 'o'. After correcting that I kept getting a msg. the a swap file exist so I deleted that file. Since then I have been getting this problem.

  7. #7
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    which help file are you talking about Tater?

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    What are you using to compile?
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by vangodo View Post
    which help file are you talking about Tater?
    Whichever help file is relevent at the moment... It's in my .sig to encourage people to actually use the help files on their systems.
    You would be absolutely amazed at how much information people ignore --even refuse to use-- that's sitting right under their noses.

    In this case, you might try looking up the errors you are getting... It might be a common problem with that compiler/IDE and you might even find a fix for it right there in your trusty old help file.

  10. #10
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    Quote Originally Posted by MK27 View Post
    What are you using to compile?
    I am using gcc 4.5.1 Apple Inc (hot 3)

  11. #11
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    From
    Today's Learnings - What You Learned Today?: undefined reference to `__gxx_personality_v0' !!!!

    The mistake was i tried to compile and link the a .cpp file by using the 'gcc' compiler. but the programs using the c++ object files should always be linked with g++ in order to supply the c++ libraries. My mistake was i tried to link the c++ object files to be linked with c libraries, and thus it showed 'Undefined reference'.
    You need to link with the correct command if compiled with g++ link with g++; if compiled with gcc link with gcc.

    NOTE: It also means if using C++ Libraries link with g++

    Tim S.

  12. #12
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    NOTE: It also means Googling your error message and doing some research yourself is a really awesome idea.

  13. #13
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    Quote Originally Posted by anduril462 View Post
    NOTE: It also means Googling your error message and doing some research yourself is a really awesome idea.
    I am not only depending on you guys for a solution. I am already googling and reading help files. It's just that this is all taking lots of time but I am enjoying it. All in the learning process!!

  14. #14
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    Quote Originally Posted by anduril462 View Post
    NOTE: It also means Googling your error message and doing some research yourself is a really awesome idea.
    Busy whole of yesterday with this problem but achieved no success! Even reinstalled Xcode.........not frustrated but tired. Just need that one tip that would get me on the right path/road to success!

  15. #15
    Registered User
    Join Date
    Sep 2011
    Posts
    9
    Spend lots of time googling but the errors came up with no find results (strange but true) found nothing!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 05-11-2011, 02:53 PM
  2. Source code not compiling...
    By darren78 in forum C++ Programming
    Replies: 6
    Last Post: 11-23-2009, 07:53 AM
  3. compiling my code, i can't fix error
    By howru in forum C Programming
    Replies: 2
    Last Post: 04-22-2008, 03:38 AM
  4. error message code
    By Flex in forum C Programming
    Replies: 1
    Last Post: 02-27-2002, 12:21 PM
  5. 2 error in source code
    By xlordt in forum C Programming
    Replies: 1
    Last Post: 01-06-2002, 02:55 AM