using C++

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
btyla
Posts: 2
Joined: Mon Feb 23, 2004 8:03 pm

using C++

Post 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
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post 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.
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
mharris
Posts: 155
Joined: Sun Jan 25, 2004 2:26 pm
Location: Annapolis, MD, USA

Post 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.
btyla
Posts: 2
Joined: Mon Feb 23, 2004 8:03 pm

Post 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]
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post 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.
Post Reply