Undefined reference to '__gxx_personality_v0'

I’v tried to compile a small test program with cc/gcc
but I’v got the following error:
/tmp/ccD16111.o<.eh_frame+0x11>: undefined reference to ‘__gxx_personality_v0’ collect2: ld command 1 exit status

I did EXACTLY as in the book.
What can I do ???


int main(){

    return 0;



What is the name of the file your trying to compile.

If the file name finish by .cc .cp .cxx .cpp .CPP. c++ .C
gcc will preprocessed source code as C++ source code.
In this case you should link your program to the libstdc++ which define the reference __gxx_personality_v0
For do that just run

gcc file.cpp -lstdc++

and the trick will be done.

But i you don’t specially do C++ and compile with gcc. Just rename your source code in .c
And run

gcc file.c