4

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?

Adam
  • 16,808
  • 7
  • 52
  • 98

2 Answers2

6

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

Marat Dukhan
  • 11,993
  • 4
  • 27
  • 41
  • This is not part of my linux distribution and not part of the llvm C++ standard library. So what shall I do? There is a `cxxabi.h` in the gcc include path, but will be work with `clang++ -stdlib=libc++`? – Walter Apr 20 '14 at 17:43
  • @Walter try `#include ` without adding any special include paths. BTW, see if `c++filt` is enough for your needs. – Adam Apr 20 '14 at 18:52
  • @Adam that (`#include `) is what I did. No, `c++filt` is not enough for my needs :-(( – Walter Apr 22 '14 at 16:44
  • @Walter I don't know then. Clang includes it on OSX, so I don't see why it wouldn't be available through some package. I don't think you can assume that you can use gcc's. – Adam Apr 22 '14 at 22:19
  • @Walter do you have `libstdc++-4.8-dev` or `libc++-dev` (or the equivalent on your distribution for your compiler) installed? – Massa Jun 04 '14 at 10:56
1

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

Chris Sherlock
  • 3,112
  • 2
  • 13
  • 9