Home Products QA Support Contact

C++ with gcc

I was compiling a program "test.cpp" with gcc on Linux. I got the error message undefined reference to '__gxx_personality_v0'. A little research showed that the compiler needed to know it was compiling c++.

cc -lstdc++ test.cpp

The really funny thing is that after running with that parameter once, it was unnecessary to do it again.

cc test.cpp all of the sudden works. Strange.