gcc ld error. Undefined reference
Hi Peoples
I was trying to compile a standard cpp file. (just a simple printf line of code). And gcc came up with the following error user@comp:~/dir$ gcc -o a test.cpp /tmp/ccIip5Jd.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status Code:
#include <stdio.h> cc does not work either (same error) g++ does work...but I would like to know wots wrong with gcc. (as far as I can tell programs have been compiling from source properly) Any Help would be much appreciated Redness |
I think it's because gcc determines file type by extension. you are calling the c compiler to compile c++ code (at least the compiler thinks it is because of the cpp extension) and it will try to link the c++ libs into the executable even though it's clearly c code. try to rename it test.c. does it compile cleanly if you do?
|
it does!
however, how come gcc cant compile c++? i didn't have the same problem on another comp using gcc redness |
g++ is not a compiler, but a shell script that sets up gcc in a different way. when gcc sees the .cpp extension, I imagine it tries to compile it but since it was not invoked with the g++ shell script is not able to do everything it needs to.
Again, I'm no expert on this, and I could be wrong. |
oh ok thanks, ill just make do.
redness |
All times are GMT -5. The time now is 07:12 AM. |