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.

Coding > GBAdev GCC + Object Oriented Programming = no compile HELP!

#17648 - cpu1333mhz - Thu Mar 11, 2004 9:58 pm

I am learning how to program for the GBA and am trying to create a simple background manager class. I get this error in the compiler (GCC):

D:\Programming\GBA\Tutor>gcc -o tutor.elf tutor.cpp -lm
C:\DOCUME~1\Bob\LOCALS~1\Temp/ccOcbaaa.o: In function `main':
C:\DOCUME~1\Bob\LOCALS~1\Temp/ccOcbaaa.o(.text+0x118): undefined reference to `__gxx_personality_sj0'
collect2: ld returned 1 exit status

Here is my class (this is a test class which does nothing):

class Test{
public:
Test(u16 tootoo){temp=tootoo;};
~Test(){}
void SetTemp(u16 tootoo){temp=tootoo;};
private:
u16 temp;
};

And here is my main code:

Test text0(8);
text0.SetTemp(55);

If I comment out the second line of my main code it complies properly. This same error has happened to me when trying to use any of the member functions of my real background manager class.

It seems like if i try to use any member functions of any class i get the error. Does anyone know whats wrong? I've tried GCC release 4 and GCC release 5 beta 3. Sorry if I am just being stupid, i'm a bit of a beginer :P

#17649 - cpu1333mhz - Thu Mar 11, 2004 10:00 pm

Note that the main code does include the int main(void){ } and other things. Im not THAT stupid :P. I just pasted the code that appears to be problematic although there really isnt much more than just that ^o^

#17651 - Paul Shirley - Thu Mar 11, 2004 10:45 pm

removed

Last edited by Paul Shirley on Sun Mar 28, 2004 9:01 pm; edited 1 time in total

#17652 - cpu1333mhz - Thu Mar 11, 2004 10:50 pm

That worked perfect. Thank you for your quick help ^_^