gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > ERROR: __gxx_personality_sj0

#49755 - justinGBA - Tue Aug 02, 2005 7:47 am

source/main.cpp:120: undefined reference to `__gxx_personality_sj0'

thats the error i reference my sprite class in main, but it says the error is on the last line of the main.cpp file...

What in the hell is this error, and how might i fix it?

#49785 - strager - Tue Aug 02, 2005 1:58 pm

justinGBA wrote:
but it says the error is on the last line of the main.cpp file...

What in the hell is this error, and how might i fix it?


Probably a missing symbol, such as a semicolin or curley brace ({ and/or })? You might also check the header files you are including, too.

#49831 - tepples - Tue Aug 02, 2005 9:09 pm

Missing semicolons or braces cause compile-time parse errors, not link-time "undefined reference" errors. It's likely that one of the C++-specific libraries isn't getting linked in correctly. Do programs written in C (not C++) work?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#49834 - justinGBA - Tue Aug 02, 2005 10:02 pm

programs in C work...
programs written in C++ work too, until i use classes or try and use new or delete. So i had an idea that it was something to do with libs, but i dont know anything about the gcclibs.

#49838 - poslundc - Tue Aug 02, 2005 10:09 pm

Not my area of expertise, but simplest pitfall to make: are you remembering to use g++ instead of gcc for C++ programs?

Dan.

#49842 - justinGBA - Tue Aug 02, 2005 10:21 pm

i fixed it, it was the order the libs where being linked in, works like a charm now.

thanks guys

I get this warning along with this error....

Linking object files
/Developer/Gameboy Advance/devkitARM/bin/arm-elf-ld: Warning: /Developer/GameBoy Advance/devkitARM/bin/../arm-elf/lib/libc.a(libcfunc.o) does not support interworking, whereas build/main.elf does

#49843 - wintermute - Tue Aug 02, 2005 10:46 pm

Don't use ld directly when linking.

For C programs use gcc to link, for C++ use g++

The example projects in devkitPro cvs do this automatically and are a good starting point for any project.