How to demangle a C++ name in clang (or gcc)?

折月煮酒 提交于 2019-12-06 06:03:23

问题


I'm trying to write a quick-and-dirty demangler for clang. I've found a piece of code that uses abi::__cxa_demangle, but I can't figure out which header it requires. The obvious choice is ABI.h but:

demangle.cpp:2:10: fatal error: 'ABI.h' file not found
#include <ABI.h>
         ^

What do I need to use abi::__cxa_demangle?


回答1:


Include cxxabi.h. In Ubuntu 13 this header is in /usr/include/c++/4.x where x is minor gcc version.




回答2:


Include cxxabi.h, but for clang on Ubuntu you'll need to install the package libc++abi-dev.



来源:https://stackoverflow.com/questions/19329525/how-to-demangle-a-c-name-in-clang-or-gcc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!