In this article at OpenGenus, we have presented the fix to resolve the compilation error Undefined reference to '
Table of contents:
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.
The fix is to:
- If you are compiling a C code using gcc, ensure that the file extension of the code file is
- If you are compiling a C++ code, ensure you compile using g++ (if you were using gcc)
-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.