×

Search anything:

[FIXED] Undefined reference to '__gxx_personality_v0'

C++

Learn Algorithms and become a National Programmer
Indian Technical Authorship Contest starts on 1st July 2023. Stay tuned.

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.

Rahul Reddy

M.Tech in Computer Science and Engineering from IIT Bhubaneswar | SDE Intern at Flipkart

Read More

Vote for Author of this article:

Improved & Reviewed by:


OpenGenus Foundation OpenGenus Foundation