Link error when using C++ exceptions (try-catch)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
korskarn
Posts: 15
Joined: Sat Dec 31, 2005 11:24 pm

Link error when using C++ exceptions (try-catch)

Post by korskarn »

I read somewhere on this forums that try-catch was supported, but when I try to compile with C++ exceptions enabled, I get the following link errors:


Code: Select all

$ make
psp-g++ -I. -I/c/devkitPro/devkitPSP/psp/sdk/include -O2 -G0 -Wall -I. -I/c/devkitPro/devkitPSP/psp/sdk/include -O2 -G0 -Wall -fexceptions -fno-rtti   -c -o main.o main.cpp
main.cpp: In function 'int main()':
main.cpp:167: warning: comparison between signed and unsigned integer expressions
main.cpp: At global scope:
main.cpp:77: warning: 'X' defined but not used
main.cpp:77: warning: 'Y' defined but not used
main.cpp:78: warning: 'MX' defined but not used
main.cpp:78: warning: 'MY' defined but not used
main.cpp:79: warning: 'bg_col' defined but not used
main.cpp:79: warning: 'fg_col' defined but not used
main.cpp:81: warning: 'g_vram_offset' defined but not used
main.cpp:83: warning: 'init' defined but not used
psp-gcc -I. -I/c/devkitPro/devkitPSP/psp/sdk/include -O2 -G0 -Wall  -L. -L/c/dev
kitPro/devkitPSP/psp/sdk/lib   main.o  -lpspdebug -lpspdisplay -lpspge -lpspctrl
 -lpspsdk -lc -lpsputility -lpspuser -lpspkernel -o cwd.elf
main.o: In function `main':
main.cpp:(.text+0x4c4): undefined reference to `__cxa_begin_catch'
main.cpp:(.text+0x4d8): undefined reference to `__cxa_end_catch'
main.cpp:(.text+0x4e8): undefined reference to `__cxa_end_catch'
main.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
c:/devkitpro/devkitpsp/bin/../lib/gcc/psp/4.0.2\libgcc.a(unwind-dw2.o): In function `base_of_encoded_value':
: undefined reference to `abort'
c:/devkitpro/devkitpsp/bin/../lib/gcc/psp/4.0.2\libgcc.a(unwind-dw2.o): In function `base_of_encoded_value':
: undefined reference to `abort'
c:/devkitpro/devkitpsp/bin/../lib/gcc/psp/4.0.2\libgcc.a(unwind-dw2.o): In function `read_encoded_value_with_base':
: undefined reference to `abort'
c:/devkitpro/devkitpsp/bin/../lib/gcc/psp/4.0.2\libgcc.a(unwind-dw2.o): In function `_Unwind_GetGR':
: undefined reference to `abort'
c:/devkitpro/devkitpsp/bin/../lib/gcc/psp/4.0.2\libgcc.a(unwind-dw2.o): In function `_Unwind_SetGR':
: undefined reference to `abort'
c:/devkitpro/devkitpsp/bin/../lib/gcc/psp/4.0.2\libgcc.a(unwind-dw2.o):: more undefined references to `abort' follow
make: *** [cwd.elf] Error 1
Someone knows the cause of the problem?
PeterM
Posts: 125
Joined: Sat Dec 31, 2005 7:25 pm
Location: Edinburgh, UK
Contact:

Post by PeterM »

I've gotten exceptions working before, but I can't immediately see anything really wrong with your command lines.

Try adding -lstdc++ to the LIBS variable in the makefile?
korskarn
Posts: 15
Joined: Sat Dec 31, 2005 11:24 pm

Post by korskarn »

Thanks, that was the problem, libstdc++ missing in the makefile! (the sample I used as a starting point was originally in C, not C++)
Post Reply