I've been getting this undefined symbol building with this command line:
$ gcc test.cpp
Undefined symbols:
"___gxx_personality_v0", referenced from:
etc...
test.cpp is simple and should build fine. What is the deal?
pseudosudo :
The .cpp extension causes gcc to compile your file as a C++ file. (See the GCC docs.)\n\nTry compiling the same file, but rename it to have a .c extension:\n\nmv test.cpp\ngcc test.c\n\n\nAlternatively, you can explicitly specify the language by passing -x c to the compiler:\n\ngcc -x c -c test.cpp -o test.o\n\n\n\n\nIf you run nm test.o on these C-language versions, you'll notice that ___gxx_personality_v0 is not listed as a symbol.\n(And if you run the same command on an object file generated with gcc -c test.cpp -o test.o, the ___gxx_personality_v0 symbol is present.)",
2009-10-26T17:13:21
inket :
Just in case anyone has the same problem as me: The file extension should be a .c not a .C (gcc is case-sensitive).",
2010-12-02T22:08:38