Page 1 of 1
using C++
Posted: Mon Feb 23, 2004 8:09 pm
by btyla
Hi,
Does the current tool chain support C++ development? I tried to some tutorial code and added a dummy C++ class, it all compiled without warning but LD was complaining about some undefined references about (my guess) low level vtable code (__register... __deregister...something).
Must I manual include some library code?
TIA
Posted: Mon Feb 23, 2004 8:54 pm
by pixel
How did you compiled it ? Can you copy/paste explicit compilation and error messages ?
However, I just suppose you linked using "gcc" or "ld" directly, and not using "g++", which automagically links the "libstdc++.a" library in.
Posted: Mon Feb 23, 2004 11:19 pm
by mharris
From my experience, you need to add -fno-exceptions to the g++ command line -- exceptions don't seem to work, w/ my version of the toolchain at least. Exceptions are nasty, performance-robbing things (in c++ anyhow), and should be avoided.
Posted: Fri Feb 27, 2004 7:27 pm
by btyla
This is the error message:
[quote]ee-gcc -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE -Tlinkfile -o bin/demo1.elf obj/demo1.o obj/g2.o obj/crt0.o obj/dma_asm.o obj/gs_asm.o obj/ps2_asm.o obj/Object.o -Wl,-Map,demo1.elf.map
/DOCUME~1/x/LOCALS~1/Temp/ccC7DPCp.o: In function `reg_frame':
/DOCUME~1/x/LOCALS~1/Temp/ccT8TuTM.c(.text+0x20): undefined reference to `__register_frame_info_table'
/DOCUME~1/x/LOCALS~1/Temp/ccC7DPCp.o: In function `dereg_frame':
/DOCUME~1/x/LOCALS~1/Temp/ccT8TuTM.c(.text+0x58): undefined reference to `__deregister_frame_info'
collect2: ld returned 1 exit status
make: *** [bin/demo1.elf] Error 1[/quote]
Posted: Fri Feb 27, 2004 11:00 pm
by mrbrown
btyla wrote:This is the error message:
ee-gcc -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE -Tlinkfile -o bin/demo1.elf obj/demo1.o obj/g2.o obj/crt0.o obj/dma_asm.o obj/gs_asm.o obj/ps2_asm.o obj/Object.o -Wl,-Map,demo1.elf.map
/DOCUME~1/x/LOCALS~1/Temp/ccC7DPCp.o: In function `reg_frame':
/DOCUME~1/x/LOCALS~1/Temp/ccT8TuTM.c(.text+0x20): undefined reference to `__register_frame_info_table'
/DOCUME~1/x/LOCALS~1/Temp/ccC7DPCp.o: In function `dereg_frame':
/DOCUME~1/x/LOCALS~1/Temp/ccT8TuTM.c(.text+0x58): undefined reference to `__deregister_frame_info'
collect2: ld returned 1 exit status
make: *** [bin/demo1.elf] Error 1
Add -fno-exceptions as mharris suggested, remove -nostdlib, or use ee-g++ instead of ee-gcc as pixel suggested. Take your pick. In the future you should read up on the compiler and linker options so that you know which option does what. Manuals are on the web or installed locally with the toolchain.