Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this error mean in c?

Tags:

c

linker

#include<stdio.h>
#include<ctype.h>

int main()
{
    char a,b;
    FILE *fp;
    fp=fopen("lext.txt","w");


    fprintf(fp,"PLUS");

return 0;
}

the error i get is this

/tmp/ccQyyhxo.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
like image 757
Hick Avatar asked Apr 18 '10 20:04

Hick


2 Answers

You are compiling a .cpp file with gcc. Rename the file to end with .c so it compiles as C code or compile it with the C++ driver g++. That will link in the stdc++ library providing these functions.

like image 102
Johannes Schaub - litb Avatar answered Oct 23 '22 06:10

Johannes Schaub - litb


ld is the linker and it is reporting that there is a link problem. The gxx part of the error message hints that it has something to do with a C++ problem which makes the answer Johannes Schaub - litb gives about the root cause correct.

like image 24
epatel Avatar answered Oct 23 '22 05:10

epatel