Demangling compiled C++ names with c++filt

The c++filt utility is a filter that copies characters from file names or standard input to standard output, replacing all mangled names with their corresponding demangled names.

You can use the filter directly with file name arguments, and the filter will output the demangled names of all mangled names in the files; or you can use a shell command that inputs text, such as specific mangled names, and pipe it to the filter, so that the filter provides the demangled names of the names you specified.

Example when you get the following mangled symbol error:

symbol lookup error: ./lib.so: undefined symbol: _ZN9ArrayItemIPcEaSES0_

$ echo _ZN9ArrayItemIPcEaSES0_ | c++filt
ArrayItem::operator=(char*)

Much easier to debug when knowing where to look :)


© 2024. All rights reserved.