×

Search anything:

[FIXED] Undefined reference to '__gxx_personality_v0'

C++

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

In this article at OpenGenus, we have presented the fix to resolve the compilation error Undefined reference to '__gxx_personality_v0'.

Table of contents:

  1. Error
  2. Fix

Error

The error comes during compilation of C++ codebase:

Undefined reference to '__gxx_personality_v0'

The reason behind this error is that the compiler linker cannot find libstdc++ or libusb and hence, an undefined reference error comes up.

The missing method is used for exception handling.

Fix

The fix is to:

  • If you are compiling a C code using gcc, ensure that the file extension of the code file is .c (small case).
  • If you are compiling a C++ code, ensure you compile using g++ (if you were using gcc)
  • Add -lstdc++ option at the end of the compilation command

This should be the compilation command:

g++ file.c -lstdc++

With this article at OpenGenus, you must have the complete idea of fixing this compilation error.

[FIXED] Undefined reference to '__gxx_personality_v0'
Share this