Click to See Complete Forum and Search --> : I can't seem to compile C++.


Stephen Philbin
08-28-2005, 06:52 AM
Hi folks, I'm having a spot of bother with my compiler (gcc version 3.3.5 on Suse Linux 9.3 professional on x86). I have a very basic bit of C source:


#include <stdio.h>

main ()
{
printf("Hello World!\n");
return 0;
};


which I have saved twice. Once per file. One file called helloworld.c and the other called helloworld.cpp.

Now when I compile it and tell my compiler to compile it as C or just leave the file with a .c extension without specifying the source type, it compiles it no problem, but if I tell it to compile the file with the .cpp extension ithout specifying -x c, or tell it to compile the file that ends .c and specify -x c++, it quits with some error.

The error says:


/tmp/ccG1AhYO.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'


Any ideas what it's telling me off for? I thought C++ was gonna be tricky because of the considerations of different OS's and CPU's, but my own compiler disliking me just takes the biscuit. :/