linker error with ASTConsumer

when i am trying to compile given source it gives linker error :

tutorial4.o:(.rodata._ZTIN5clang13MyASTConsumerE[typeinfo for clang::MyASTConsumer]+0x10): undefined reference to `typeinfo for clang::ASTConsumer’
collect2: ld returned 1 exit status
make: *** [tutorial4] Error 1

Source code is: all necessary header files are included and there is no syntax error in this source code, required libraries are also specified in make file.

LLVM and Clang are compiled with -fno-rtti by default. You have three options:

  • You can re-enable RTTI when you build LLVM and Clang.
  • If you don’t use RTTI in your project, you can just compile with -fno-rtti.
  • You can compile every file that emits the vtable for this class with -fno-rtti. The easier way to do this is to anchor the vtable to a particular file and compile that with -fno-rtti.